You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a static website, having a search function significantly enhances the user experience, allowing readers to locate content quickly and efficiently. Whether you’re managing a personal blog or a comprehensive documentation site, a search box is an essential feature to improve navigation and engagement.
26
+
As a static website, having a search function significantly enhances the user experience, allowing readers to locate content quickly and efficiently. Whether you’re managing a personal blog or a comprehensive documentation site, a search box is an essential feature to improve navigation and engagement.
14
27
15
-
In this article, we’ll guide you through the step-by-step process of integrating a search box into your Hugo-powered site. We’ll be using **Pizza**, a blazing-fast, WASM-based search engine that outperforms traditional JavaScript-based solutions. Pizza supports the complete Lucene query syntax, offering robust and versatile search capabilities for your site. From setup to customization, we’ll cover everything you need to create a powerful and seamless search experience.
28
+
In this article, we’ll guide you through the step-by-step process of integrating a search box into your Hugo-powered site. We’ll be using **Pizza**, a blazing-fast, WASM-based search engine that outperforms traditional JavaScript-based solutions. Pizza supports the complete Lucene query syntax, offering robust and versatile search capabilities for your site. From setup to customization, we’ll cover everything you need to create a powerful and seamless search experience.
16
29
17
30
## What is INFINI Pizza?
18
31
@@ -23,6 +36,7 @@ Currently, The website of INFINI Pizza have integrated INFINI Pizza for WebAssem
Visit the website ([http://pizza.rs](http://pizza.rs/)), and by pressing the shortcut key 's', you can bring up the search box and experience the search capabilities provided by INFINI Pizza. Notably, during the search process, all of your actions are executed locally in the browser. Unlike traditional search implementations, where each query requires an interaction with a backend search server, INFINI Pizza for WebAssembly operates entirely offline. Even if you're disconnected from the internet, you can still enjoy a seamless search experience.
27
41
28
42
Without further ado, let's dive into how you can use INFINI Pizza for WebAssembly on your own site.
@@ -58,9 +72,9 @@ Since the example project has already uploaded the compiled code and samples, we
> the tag `docsearch` may be renamed to `searchbox` in the future
182
+
> the tag `docsearch` may be renamed to `searchbox` in the future
171
183
172
184
With that, the task is complete!
173
185
@@ -176,9 +188,8 @@ Open your browser to see the final result:
176
188
177
189
Finally, to summarize, with the help of the 3 lines of code and copy 3 files from INFINI Pizza searchbox, you can add a lightweight offline search functionality to your static site in just 5 minutes. Give it a try!
Profiling Rust code has become part of my daily routine. As I primarily develop on macOS, I've noticed there aren't many tools that allow for easy and quick profiling of Rust applications. So, I’d like to share my daily profiling workflow, in case it helps others. If you have other approaches or tools that work well for you, feel free to share—I’d love to hear them!
14
17
15
-
16
18
## Setting Up Micro-Benchmarks
17
19
18
20
I use micro-benchmark tests to track the performance of critical functions in my Rust application. For this, I rely on `criterion`, which is both powerful and easy to use. Here’s what my project setup looks like:
19
21
20
-
21
22

22
23
23
24
As you noticed, i organized my benchmark tests per module, and so i can easily include or exclude specify tests in the `benches.rs`, some times, they just take too much time, if i only want to profile specify tests, i can just comment out unrelated one. dirty but works.
@@ -28,10 +29,10 @@ If you have many similar tests, you may group them by use a customized name, lik
28
29
29
30
Micro-benchmarking is a fundamental step that helps track performance changes when refactoring code or adding new features.
30
31
31
-
32
32
## Profiling The Micro-Benchmark
33
33
34
34
What if some tests are slow, a quick way to profiling is to use:
@@ -42,14 +43,10 @@ You can run the benchmarks with a single command, but be sure to comment out any
42
43
43
44
Now that you have several micro-benchmark tests, how can you continuously monitor performance? I’m glad I discovered a free service provided by bencher.dev. It helps track performance over time, making it easier to identify any regressions or improvements.
44
45
45
-
46
-
47
46

48
47
49
-
50
-
51
-
52
48
Here is my bencher command in my Makefile:
49
+
53
50
```shell
54
51
bencher-engine:
55
52
if [ -z"${BENCHER_API_TOKEN:-}" ];then \
@@ -75,12 +72,12 @@ You can add a CI action to your GitHub repository to automatically track perform
75
72
76
73

77
74
78
-
## Profiling on MacOs
75
+
## Profiling on MacOs
79
76
80
77
Profiling on macOS can be slightly less convenient than on Linux, where there are many robust tools available. Here’s what I do to make the most of the profiling process, I use `Dtrace` along with two scripts:
Open it with your web browser and figure out what's the bottlenect, and rock with it.
131
130
132
131

133
132
134
-
135
133
That’s it! I hope this information helps you in your Rust development journey. If you have any questions or need further assistance, feel free to reach out!
0 commit comments