Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions JetStreamDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,33 @@ let BENCHMARKS = [
exposeBrowserTest: true,
tags: ["default", "js", "RexBench"],
}),
new AsyncBenchmark({
name: "emoji-regex",
files: [
"./utils/StartupBenchmark.js",
"./emoji-regex/benchmark.js",
],
preload: {
BUNDLE: "./emoji-regex/dist/bundle.es6.min.js",
"small.md": "./emoji-regex/data/small.md",
"medium.md": "./emoji-regex/data/medium.md",
"large.md": "./emoji-regex/data/large.md",
"zh.md": "./emoji-regex/data/zh.md",
"hi.md": "./emoji-regex/data/hi.md",
"vi.md": "./emoji-regex/data/vi.md",
"msg1.md": "./emoji-regex/data/msg1.md",
"msg2.md": "./emoji-regex/data/msg2.md",
"msg3.md": "./emoji-regex/data/msg3.md",
"msg4.md": "./emoji-regex/data/msg4.md",
"msg5.md": "./emoji-regex/data/msg5.md",
"msg6.md": "./emoji-regex/data/msg6.md",
"msg7.md": "./emoji-regex/data/msg7.md",
"msg8.md": "./emoji-regex/data/msg8.md",
"msg9.md": "./emoji-regex/data/msg9.md",
"msg10.md": "./emoji-regex/data/msg10.md",
},
tags: ["default", "js", "regexp", "markdown", "unicode"],
}),
new DefaultBenchmark({
name: "validatorjs",
files: [
Expand Down
71 changes: 71 additions & 0 deletions emoji-regex/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2026 Apple Inc. All rights reserved.
* Copyright 2026 Google LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/

class Benchmark extends StartupBenchmark {
results = [];
totalHash = 0xdeadbeef;
samples = [];

constructor({iterationCount}) {
super({
iterationCount,
expectedCacheCommentCount: 122,
sourceCodeReuseCount: 4,
});
}

async init() {
const mdFileNames = [
"small.md", "medium.md", "large.md",
"zh.md", "hi.md", "vi.md",
"msg1.md", "msg2.md", "msg3.md", "msg4.md", "msg5.md",
"msg6.md", "msg7.md", "msg8.md", "msg9.md", "msg10.md",
];
await Promise.all([
super.init(),
...mdFileNames.map(file => this.loadData(file)),
]);
}

async loadData(fileName) {
const content = await JetStream.getString(JetStream.preload[fileName]);
this.samples.push(content);
console.assert(content.length > 0);
}

runIteration(iteration) {
let EmojiRegexBenchmark;
eval(this.iterationSourceCodes[iteration]);

for (const sample of this.samples) {
const result = EmojiRegexBenchmark.render(sample);
if (result.length <= 0) {
throw new Error(`Invalid result length: ${result.length}`);
}
this.totalHash ^= this.quickHash(result);
}
}
}
19 changes: 19 additions & 0 deletions emoji-regex/data/hi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# हिंदी 🇮🇳 परीक्षण

यह एक हिंदी मार्कडाउन परीक्षण फ़ाइल है।

## मुख्य 📝 बिंदु:
1. यह पहला 👋🏾 बिंदु है। (नमस्ते)
2. यह 🧘🏿‍♂️ दूसरा बिंदु है। (योग)
3. यह तीसरा 🤝 बिंदु है। (साझेदारी)

**महत्वपूर्ण:** _कृपया ⚠️ ध्यान दें_

| वस्तु | मात्रा |
| :--- | :---: |
| आम 🥭 | 10 |
| क्रिकेट 🏏 बैट | 2 |

अन्य: 🥘

आशा 🧡 है आपको पसंद आएगा!
41 changes: 41 additions & 0 deletions emoji-regex/data/large.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Subject: Weekly 📅 Update

Hi Team,

Here is the update for this week. We have made 🎉 **great progress**!

## Highlights 🌟
- Feature A is complete! ✅
- Sub-task A.1 🔨 done
- Sub-task 🔧 A.2 done
- Bug 🐛 B is fixed 🔫.
- Performance 📈 is up by 10%.

## Code Snippet 💻

```javascript
function hello() {
console.log("Hello 🌍");
}
```

## Data 📊 Analysis

| Metric | Previous | Current | Change |
| :--- | :---: | :---: | ---: |
| Users 👤 | 100 | 120 👥 | +20% 🆙 |
| Errors ❌ | 5 | 2 📉 | -60% 🆒 |

---

## Next steps 👣
1. Start 🚧 working on Feature C.
2. Review 📝 the design docs.
3. Team 🍕 lunch on 🍔 Friday! 🍟

> Note: Don't forget ⏰ to update your timesheets!

Please let me know ❓ if you have any questions.

Cheers,
The 👯‍♂️ Team
18 changes: 18 additions & 0 deletions emoji-regex/data/medium.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Medium 📏 Test

Here is some 🗣️ more text. It has a few more emojis.

> "Quotes are 🗣️ great"

1. Line 1: 🍎 Banana 🍌 Grape 🍇
2. Line 2: Dog 🐶 Cat 🐱 Mouse 🐭
3. Line 3: Car 🚗 Taxi 🚕 SUV 🚙

[Link 🔗 to nowhere](http://example.com)

| Item | Emoji |
|------|-------|
| 🍎 Apple| Fruit |
| 🚗 Car | Vehicle |

Hope this is 😉 enough for a _medium_ test.
1 change: 1 addition & 0 deletions emoji-regex/data/msg1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hey! 👋 What's up?
1 change: 1 addition & 0 deletions emoji-regex/data/msg10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Call me 📞 when you get this. ❗
1 change: 1 addition & 0 deletions emoji-regex/data/msg2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On my way 🚗💨 be there soon!
1 change: 1 addition & 0 deletions emoji-regex/data/msg3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOL 😂 that's hilarious! 🤣
1 change: 1 addition & 0 deletions emoji-regex/data/msg4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Can you buy 🥛 and 🍞 on your way home? 🙏
1 change: 1 addition & 0 deletions emoji-regex/data/msg5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
🎉 Happy Birthday!!! 🎂🎈🎁
1 change: 1 addition & 0 deletions emoji-regex/data/msg6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm so tired 😴... Goodnight 🌙
1 change: 1 addition & 0 deletions emoji-regex/data/msg7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Did you see the game? 🏈 What a catch! 😲
1 change: 1 addition & 0 deletions emoji-regex/data/msg8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Thinking about 🤔 pizza 🍕 for dinner?
1 change: 1 addition & 0 deletions emoji-regex/data/msg9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
❤️ Love you! 😘
7 changes: 7 additions & 0 deletions emoji-regex/data/small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Small 🧪 Test

Hello 😀 world! This is a **small** 🚀 test.

## Features
- *Italic* ✍️ text
- `Inline 💻 code`
19 changes: 19 additions & 0 deletions emoji-regex/data/vi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Kiểm tra ✨ Tiếng Việt 🇻🇳

Đây là một tệp kiểm tra Markdown bằng Tiếng Việt.

## Điểm 📜 nổi bật:
* Đây là điểm 👌🏼 đầu tiên. (Được)
* Đây là điểm 🛵 thứ hai. (Xe máy)
* Đây là điểm thứ 🍜 ba. (Phở)

---

### Đoạn 💃🏻 trích
> "Không có gì 🇻🇳 quý hơn độc lập tự do."
[Liên kết 🔗 mẫu](https://example.com)

Khác: 🌴 ☕

Hy vọng bạn 🧡 thích nó!
21 changes: 21 additions & 0 deletions emoji-regex/data/zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 繁體 🇹🇼 中文測試

這是一個繁體中文的 Markdown 測試文件。

## 重點 📋 清單
- 這是 👍🏽 第一點。(讚)
- 子項目 🅰️ A
- 這是第二點 🙅🏻‍♀️。(不)
- 這是 👩‍💻 第三點。(工程師)

## 程式碼 ⌨️ 區塊

```python
print("你好,世界! 🌏")
```

> 引用:學而不思 🤔 則罔。

其他:🌮 墨西哥卷 🌺 花 🏃🏿‍♂️ 跑步

希望 🧡 你喜歡!
Loading
Loading