Andreas Kling
dba6216caa
LibWeb: Skip CSS tokenizer filtering when string has no '\r' or '\f'
...
When loading a canned version of reddit.com, we end up parsing many many
shadow tree style sheets of roughly ~170 KiB text each.
None of them have '\r' or '\f', yet we spend 2-3 ms for each sheet just
looping over and reconstructing the text to see if we need to normalize
any newlines.
This patch makes the common case faster in two ways:
- We use TextCodec::Decoder::to_utf8() instead of process()
This way, we do a one-shot fast validation and conversion to UTF-8,
instead of using the generic code-point-at-a-time callback API.
- We scan for '\r' and '\f' before filtering, and if neither is present,
we simply use the unfiltered string.
With these changes, we now spend 0 ms in the filtering function for the
vast majority of style sheets I've seen so far.
2024-07-20 15:35:30 +02:00
..
2024-07-20 15:35:30 +02:00
2024-07-17 15:08:44 +01:00
2024-04-27 18:29:35 -04:00
2024-04-09 09:13:06 +02:00
2024-02-16 12:02:11 -07:00
2023-12-30 20:11:24 +01:00
2023-12-30 20:11:24 +01:00
2024-07-19 09:04:30 +01:00
2024-04-27 18:29:35 -04:00
2024-04-09 09:13:06 +02:00
2024-02-16 12:02:11 -07:00
2024-03-16 16:35:54 +01:00
2024-02-28 22:14:58 +01:00
2024-02-28 22:14:58 +01:00
2024-05-08 10:39:16 +02:00
2024-05-08 10:39:16 +02:00
2024-03-16 16:35:54 +01:00
2024-03-18 14:06:28 -04:00
2024-03-18 14:06:28 -04:00
2024-05-19 16:24:11 +02:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-05-01 07:21:21 +02:00
2024-02-28 22:14:58 +01:00
2024-03-16 16:35:54 +01:00
2024-01-18 14:00:06 +01:00
2024-05-26 07:55:50 +02:00
2024-04-27 18:29:35 -04:00
2024-04-16 07:40:01 +02:00
2024-02-24 21:59:28 +01:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-06-14 20:45:37 +02:00
2024-03-19 16:48:22 +01:00
2024-04-16 07:40:01 +02:00
2024-05-04 21:42:59 +02:00
2024-02-24 21:59:28 +01:00
2024-03-16 16:35:54 +01:00
2024-02-28 22:14:58 +01:00
2024-04-27 18:29:35 -04:00
2024-06-16 07:12:46 +02:00
2024-03-29 21:58:12 +01:00
2024-07-20 13:09:28 +02:00
2024-07-19 09:04:30 +01:00
2024-07-13 09:31:02 +02:00
2024-06-30 13:09:23 +02:00
2024-05-14 12:31:10 -06:00
2024-06-07 19:30:35 +02:00
2024-06-07 19:30:35 +02:00
2024-06-07 19:30:35 +02:00
2024-01-05 13:21:09 +01:00
2024-01-05 13:21:09 +01:00
2024-07-10 17:41:18 +02:00
2024-06-04 18:45:30 +02:00
2024-03-02 13:00:09 +01:00
2024-03-16 16:35:54 +01:00
2024-02-24 21:59:28 +01:00
2024-06-22 14:57:47 +02:00
2024-06-22 14:57:47 +02:00
2024-03-16 16:35:54 +01:00
2024-03-16 16:35:54 +01:00
2024-05-08 10:39:16 +02:00
2024-05-08 10:39:16 +02:00
2024-03-02 13:00:09 +01:00
2024-06-13 11:18:38 +02:00
2024-06-13 11:18:38 +02:00
2024-06-18 10:31:54 -04:00
2024-06-18 10:31:54 -04:00
2024-07-19 09:04:30 +01:00
2024-07-15 11:52:03 +01:00
2024-03-03 19:50:25 +01:00
2023-12-30 20:11:24 +01:00
2023-12-30 20:11:24 +01:00
2024-07-10 10:25:04 -06:00
2023-12-17 23:12:34 +01:00
2024-05-27 17:24:51 -06:00
2024-05-27 17:24:51 -06:00
2024-05-27 17:24:51 -06:00
2024-04-27 18:29:35 -04:00
2024-04-03 10:09:58 +01:00
2024-04-03 10:09:58 +01:00
2024-07-15 11:52:03 +01:00
2024-03-22 18:27:32 +01:00
2024-07-15 11:52:03 +01:00
2024-07-15 11:52:03 +01:00
2024-03-03 19:50:25 +01:00
2023-12-10 17:32:04 +01:00
2024-01-07 09:03:57 +01:00
2024-01-07 09:03:57 +01:00
2024-07-17 15:08:44 +01:00
2024-06-30 13:09:23 +02:00
2024-07-19 09:04:30 +01:00
2024-03-19 17:30:34 +01:00
2024-07-19 09:04:30 +01:00
2024-07-19 09:04:30 +01:00
2024-04-29 08:10:38 +02:00
2024-04-29 08:10:38 +02:00
2024-04-29 08:10:38 +02:00
2024-04-29 08:10:38 +02:00
2024-04-21 19:32:49 +02:00
2024-07-04 13:22:40 +02:00
2024-07-04 13:22:40 +02:00
2024-04-05 08:14:19 +02:00
2024-04-05 08:14:19 +02:00
2024-02-21 19:38:17 +01:00
2024-01-10 09:48:25 +01:00
2024-01-10 09:48:25 +01:00
2024-03-16 16:35:54 +01:00