Before also introduced several syntax highlighting plug-in "for the blog park to choose a small domineering syntax highlighting plug-in" and about their comprehensive performance "re-discuss the choice of syntax highlighting plugin."
Today in Xiaoying blog see "Using Prism.js to achieve beautiful code syntax highlighting" so whim went to see the next, by the way test performance.
Open Prism.js official website and see used by.
I'm not a small man.
Then read the next example, sure enough, a very interesting plug-in, so I downloaded to the local jQuery highlight rendering test.
The test method is the same as before, in order to compare with the previous plug-in, of course, my computer did not change, or the previous one, so can be compared.
I le a fork, unexpectedly want 48 seconds,, slow out of Xiang, the rhythm of the inverse of the day ah.
The matching accuracy is generally just 30,000 points.
Combined with the last test results, look at the ranking table again.
| ranking |
name |
Render Time |
Number of nodes |
| 1 |
Shjs |
627ms |
33985 Node |
| 2 |
Pretiffy |
1.26S |
59802 Node |
| 3 |
Highlight |
567ms |
8432 Node |
| 4 |
Snippet |
9.40S |
43775 Node |
| 5 |
Prism |
48.56S |
36225 Node |
You can choose according to your own needs, but also to pay attention to compatibility. If you want all-rounder, the preferred codemirror.
Of course, Prism is not useless, or the big guy will not choose him.
The way he calls, the design of how human ah, these are we can learn from.
Of course, these features you use SHJS + JQuery is also very easy to implement, you can create a small and powerful syntax highlighting plug-in.
Well, this is the end of today's share.