javascripters:CodeMirror.net 是显示大型不可编辑代码片段的有效选择吗?

发布于 2025-01-02 05:49:01 字数 273 浏览 1 评论 0原文

我真的很喜欢 codemirror.net

我现在用它来渲染我的网站中的一些大代码片段。

我的问题是: 由于我不使用代码镜像为我提供的任何在线实时编辑功能,我真的应该选择一个更轻的库吗?

这对我来说是一个真正的问题,因为我正在显示 10000 行代码片段,并且快速渲染器很重要。

有人可以从技术上捍卫或指责我对代码镜像的使用吗?

谢谢,

ps 请大家不要建议在服务器端进行解析/渲染。它需要在浏览器上完成,原因有很多,我不需要解释。

I really like codemirror.net

And I am now using it just to render some large snippets of code in my web site.

My question is:
Should I really opt for a lighter library since I don't use any of the online-live-editing-features that code mirror gives me ?

This is a real issue for me because I am displaying snippets of 10000 lines of code and a fast renderer matters.

Can somebody technically defend or accuse my usage of code mirror ?

Thanks,

p.s.
Please guys don't suggest to do the parsing/rendering on the serverside. It needs to be done on the browser for many reasons I need not to explain.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开柳相依 2025-01-09 05:49:01

你的问题是主观的,但我会尽力回答。

在其他条件相同的情况下,您不需要的功能最少的库将是最适合您的。如果您从不打算允许编辑,那么您可能会在渲染时支付一些未使用的间接费用。因此,我认为 CodeMirror 可能不是最佳选择。

也就是说,使用任何对你有用的东西。 CodeMirror 适合您吗?你理解它并且感到舒服吗?它的速度是否足以满足您的预期目的,或者您是否觉得它因文件大小而陷入困境?您的应用程序的路线图上是否包含编辑功能?这些是您需要提出的问题,并且只有您可以回答。

人们已经写了很多东西,他们知道这些东西不是最高效的,有时甚至非常慢,但它更容易,而且他们知道它足够快。并不是每个程序都必须是光滑的和超级优化的,如果要想得到什么,就需要付出太多的努力才能到达那里。

Your question is subjective, but I'll try and answer.

All else being equal, the library with the least number of features you don't need will be the best for you. If you never plan on allowing editing, you probably are paying some overhead cost in rendering for it that isn't being utilized. For that reason I'd say CodeMirror probably isn't the best choice.

That said, use whatever works for you. Does CodeMirror work for you? Do you understand it and is it comfortable? Is it fast enough for your intended purpose, or do you feel it is bogging down with your file sizes? Is editing ever on the roadmap for your application? These are the questions you need to be asking and only you can answer.

People have written plenty of things they knew weren't the most efficient and sometimes were downright slow, but it was easier and they knew it was fast enough. Not every program has to be sleek and super optimized if it requires too much effort to get there for what you'll get out of it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文