@@ -8,68 +8,68 @@ msgid ""
88msgstr ""
99"Project-Id-Version : bitproto 0.4.0\n "
1010"Report-Msgid-Bugs-To : \n "
11- "POT-Creation-Date : 2021 -02-04 10:53 +0800\n "
11+ "POT-Creation-Date : 2022 -02-24 10:21 +0800\n "
1212"PO-Revision-Date : YEAR-MO-DA HO:MI+ZONE\n "
1313"Last-Translator : FULL NAME <EMAIL@ADDRESS>\n "
1414"Language-Team : LANGUAGE <LL@li.org>\n "
1515"MIME-Version : 1.0\n "
1616"Content-Type : text/plain; charset=utf-8\n "
1717"Content-Transfer-Encoding : 8bit\n "
18- "Generated-By : Babel 2.9.0 \n "
18+ "Generated-By : Babel 2.9.1 \n "
1919
20- #: ../../performance.rst:4 a266f980800a4873b6e52dd3cfaa030a
20+ #: ../../performance.rst:4 3f9fa565a7ad4ff4997b60a9d0f760e2
2121msgid "Performance"
2222msgstr "性能表现"
2323
24- #: ../../performance.rst:6 10478d32dda84313819212e35fd5f76b
24+ #: ../../performance.rst:6 a59f07dbd2b248b3b288b6212f03b198
2525msgid ""
2626"This document will introduce the performance of bitproto encoding and "
2727"decoding, along with the optimization mechanism."
2828msgstr "本文将介绍 bitproto 的编解码性能表现和优化机制。"
2929
30- #: ../../performance.rst:12 d4a1bb6ffa9d4ddcab512c2b28008d61
30+ #: ../../performance.rst:12 7ac153bc2cbd4ff4b103fa7abea7e64a
3131msgid "Performance Benchmark"
3232msgstr "性能压测"
3333
34- #: ../../performance.rst:14 3190f759276b4d60874179656d096feb
34+ #: ../../performance.rst:14 788f1c312b2e42098abe3a3787611a10
3535msgid "Benchmark of bitproto encoding/decoding shows that it runs very fast."
3636msgstr "对 bitproto 的编解码的性能压测结果显示,它跑的非常快。"
3737
38- #: ../../performance.rst:17 e335d07890764b33bf8aa353c441fa90
38+ #: ../../performance.rst:17 a3f0da4f3bc84c82b8a79e05dc40c74d
3939msgid "Unix OS"
4040msgstr "Unix 系统"
4141
42- #: ../../performance.rst:19 4f6e4b9a04244b99903b8bbe44b8fab5
42+ #: ../../performance.rst:19 c99265ff2d854276848baad8794aed23
4343msgid ""
4444"On unix like systems (mac, ubuntu etc.), a single encoding/decoding call "
4545"costs:"
4646msgstr "在类 unix 系统 (mac, ubuntu etc.) 上,一次编码调用或者解码调用占用:"
4747
48- #: ../../performance.rst:21 d44f4adcfd7d470dabf3a387912d5a75
48+ #: ../../performance.rst:21 ac31640e500749a1a969649cda6d1967
4949msgid "``< 2μs`` in C"
5050msgstr "C 语言中 ``< 2μs``"
5151
52- #: ../../performance.rst:22 54bccc90a1ac4750b4b443d06b43d9a2
52+ #: ../../performance.rst:22 2b352cc04f784788867abb00b5484ead
5353msgid "``< 10μs`` in Go"
5454msgstr "Go 语言中 ``<10μs``"
5555
56- #: ../../performance.rst:23 b69a668531594829810f350e6bdbc095
56+ #: ../../performance.rst:23 13bef9d15f5141ce97a5d0c1d49f982a
5757msgid "``< 1ms`` in Python"
5858msgstr "Python 语言中 ``< 1ms``"
5959
60- #: ../../performance.rst:25 a1c4268f9b0449bb9fc37aa0990af408
60+ #: ../../performance.rst:25 aa3094853b1b41899a5d8d9fb0e5362e
6161msgid ""
6262"You can checkout `the detail benchmark results for unix on github "
6363"<https://github.com/hit9/bitproto/tree/master/benchmark/unix>`_."
6464msgstr ""
6565"你可以在 `github 上查看 unix 系统上详细的压测结果 "
6666"<https://github.com/hit9/bitproto/tree/master/benchmark/unix>`_ 。"
6767
68- #: ../../performance.rst:28 53cb6681f3e5430d86f7dee3dab2281a
68+ #: ../../performance.rst:28 8c22d25bf93b44978c0ca033bec69f41
6969msgid "Embedded"
7070msgstr "嵌入式"
7171
72- #: ../../performance.rst:30 156b14e4d2224a9380afe6281009074b
72+ #: ../../performance.rst:30 6f00958b202142c99ed0d1e6a98e1894
7373msgid ""
7474"I have tested the benchmark on a `stm32 board "
7575"<https://www.st.com/content/st_com/en/products/microcontrollers-"
@@ -85,19 +85,19 @@ msgstr ""
8585"cortex-m3 72MHz cpu) 上进行了压测测试, 一次编码调用或者解码调用占用 ``160 μs`` 左右的时间,并且可以通过 "
8686":ref:`优化模式 <performance-optimization-mode>` 来降低到 ``9 μs`` 左右。"
8787
88- #: ../../performance.rst:34 2d3fd08418c3476f8d3657f35fccfebd
88+ #: ../../performance.rst:34 a7e21c83a62444128647cd7eb165dc76
8989msgid ""
9090"You can checkout `the detail benchmark results for stm32 on github "
9191"<https://github.com/hit9/bitproto/tree/master/benchmark/stm32>`_."
9292msgstr ""
9393"你可以在 `github 上查看 stm32 上详细的压测结果 "
9494"<https://github.com/hit9/bitproto/tree/master/benchmark/stm32>`_ 。"
9595
96- #: ../../performance.rst:39 84d37078007e461ca24d471be16638a2
96+ #: ../../performance.rst:39 ad92d04793de49b2915c8130d15988c3
9797msgid "The Optimization Mode"
9898msgstr "优化模式"
9999
100- #: ../../performance.rst:41 579b722162f0420380482f7d023d929b
100+ #: ../../performance.rst:41 57bf44a750604e3fae7f457d89dc48b1
101101msgid ""
102102"For most cases, the performance may meet the requirements. But if you are"
103103" not satisfied with this, there's still a way to go, the called "
@@ -107,11 +107,11 @@ msgstr ""
107107"对于大多数场景,bitproto 的性能应该可以满足需求。但是如果你对此不满意,仍然有一种方法可以尝试,即 bitproto 中所谓的 "
108108"\" 优化模式\" 。通过给 bitproto 的编译器添加一个 选项 ``-O`` , 可以开启优化模式:"
109109
110- #: ../../performance.rst:49 e6579dadd3994b5bbe3e6966f878f9db
110+ #: ../../performance.rst:49 d1c0c280dc8145ebb3e3ec81efabb674
111111msgid "By this way, bitproto will generate code for you in optimization mode."
112112msgstr "这样,bitproto 会生成优化模式下的代码。"
113113
114- #: ../../performance.rst:51 3ffa6b66bdeb475297d7d52c539ddaa6
114+ #: ../../performance.rst:51 b03ab717d6214c84a2df771923ecffcb
115115msgid ""
116116"The mechanism behind optimization mode is to generate plain "
117117"encoding/decoding code statements directly at code-generation time. We "
@@ -124,7 +124,7 @@ msgstr ""
124124"中所有的类型都是定长的,因此在代码生成阶段是完全可以知道如何对数据进行编解码的。在代码生成阶段,bitproto "
125125"会遍历消息的所有字段然后生成比特拷贝的语句。"
126126
127- #: ../../performance.rst:58 43fa73b31d03496c9ae5f06278874c43
127+ #: ../../performance.rst:58 b7b6978f1d6d4c9887c17b8e370307ab
128128msgid ""
129129"The optimization mode doesn't work for :ref:`extensible messages "
130130"<language-guide-extensibility>`. Because extensible messages decoding "
@@ -133,13 +133,13 @@ msgstr ""
133133"优化模式不支持和 :ref:`扩展性消息 <language-guide-extensibility>` "
134134"一起工作。因为扩展性消息的解码需要依赖动态的计算。"
135135
136- #: ../../performance.rst:61 c6c8996c2e6b455bb50adcf2ffd4b5cf
136+ #: ../../performance.rst:61 a4f55d31f811438c8417a8a87b159d62
137137msgid ""
138138"For an instance in C, the generated code in optimization mode looks like "
139139"this:"
140140msgstr "以 C 语言举例,优化模式下生成的代码是这个样子的:"
141141
142- #: ../../performance.rst:77 0b94d30b8e6049c989eac7f57fbd693a
142+ #: ../../performance.rst:77 cc338bc7531c4c429bae6c30973fa54e
143143msgid ""
144144"See the generated code example above, there's no loops, no if-else, all "
145145"statements are plain bit operations. In this way, bitproto's optimization"
@@ -148,7 +148,7 @@ msgstr ""
148148"上面的生成代码中,没有循环语句、没有 if-else 语句,所有的语句都是直白的比特操作。通过这种方式,bitproto "
149149"的优化模式可以给我编解码效率上最大化的提升。"
150150
151- #: ../../performance.rst:80 1b357537ecac420e99b7dd218150a394
151+ #: ../../performance.rst:80 decfd75d51194b67b48e476beeaf8cb2
152152msgid ""
153153"It's fine of course to use optimization mode on one end and non-"
154154"optimization mode (the standard mode) on another end in message "
@@ -159,7 +159,7 @@ msgstr ""
159159"对于通信双方中,一方使用无优化模式 "
160160"(标准模式),一方使用优化模式,这种情况也是没有问题的。优化模式只改变了编码函数和解码函数的编写方式,并没有改变数据的交换格式。"
161161
162- #: ../../performance.rst:84 0aab94a0796948d88186ff783a525f86
162+ #: ../../performance.rst:84 1479eef78e9041ff833a31815438440c
163163msgid ""
164164"In fact, using the optimization mode is also a trade-off sometimes. In "
165165"this mode, we have to drop the benefits of :ref:`extensibility <language-"
@@ -173,23 +173,23 @@ msgstr ""
173173"extensibility>` "
174174",这样其实对协议的兼容性设计是不友好的。优化模式是为了性能敏感的场景设计的,比如低功耗的嵌入式板,计算密集的微控制器。在以下场景下,推荐使用优化模式:"
175175
176- #: ../../performance.rst:89 30f46c8635cc4f189aa7ae85963d7f1c
176+ #: ../../performance.rst:89 e5289a76f06c4079b9457a2f18bdd6f1
177177msgid ""
178178"Performance-sensitive scenarios, where ``100μs`` means totally different "
179179"with ``10μs``."
180180msgstr "性能敏感的场景,``100μs`` 和 ``10μs`` 完全不是一回事。"
181181
182- #: ../../performance.rst:90 6276e2c7c9574bffa74573391de9735b
182+ #: ../../performance.rst:90 93d2930a06d8474eb1fc5cd8552611fb
183183msgid ""
184184"The firmwares of communication ends are always upgraded together, thus "
185185"the backward-compatibility is not so important."
186186msgstr "通信相关方的固件升级总是一起进行的,这样向后兼容性就不那么重要了。"
187187
188- #: ../../performance.rst:91 9953ef6e28d9446eb636044f4cbc4c93
188+ #: ../../performance.rst:91 d5cdd86545854648a25d6f7c417062b0
189189msgid "Firmware updates are not frequent, even only once for a long time."
190190msgstr "固件的升级并不会频繁,甚至很长时间一次。"
191191
192- #: ../../performance.rst:93 731df8dd4b0b4f4abe36ec6e5de6d3fb
192+ #: ../../performance.rst:93 50a0919ac7a740c6a54e25e4fbd024d9
193193#, python-format
194194msgid ""
195195"Specially, for the scenario that firmware-upgrading of communication ends"
@@ -203,51 +203,53 @@ msgstr ""
203203"<https://en.wikipedia.org/wiki/Client%E2%80%93server_model>`_ "
204204",我还是推荐坚持使用标准模式,而不是优化模式。"
205205
206- #: ../../performance.rst:97 a190f2c6a02e4d1c81a261381b6b51da
206+ #: ../../performance.rst:97 1d7d5d2606b742dcbebac52661bc688f
207207msgid ""
208208"The optimization mode is currently supported for language C and Go, (not "
209209"yet Python)."
210210msgstr "目前,bitproto 的优化模式只支持 C 语言和 Go 语言,目前还不支持 Python 。"
211211
212- #: ../../performance.rst:99 b16cf3f8c36a49a0b6010693b23e120c
212+ #: ../../performance.rst:99 19b64ae69eb546c7b1f01eb2ced8a0f7
213+ #, fuzzy
213214msgid ""
214215"Another benefit of optimization mode is that the bitproto libraries are "
215216"no longer required to be dropped in. The bitproto compiler in "
216217"optimization mode already throws out the final encoding and decoding "
217218"statements, so the bitproto libraries aren't required. The libraries are "
218- "designed to used with standard mode, where protocol extensibility is a "
219+ "designed to use with standard mode, where protocol extensibility is a "
219220"feature."
220- msgstr "优化模式所带来的另一个好处是不必在使用支持库了。因为 bitproto 的编译器在优化模式下已经生成了最终的编解码语句,"
221- "因此 bitproto 的支持库就不需要了。这些支持库最初的设计是为了支持标准模式下的协议扩展性能力。"
221+ msgstr ""
222+ "优化模式所带来的另一个好处是不必在使用支持库了。因为 bitproto 的编译器在优化模式下已经生成了最终的编解码语句,因此 bitproto "
223+ "的支持库就不需要了。这些支持库最初的设计是为了支持标准模式下的协议扩展性能力。"
222224
223- #: ../../performance.rst:105 44c905a9afb344ee859b5fd5e72837cc
225+ #: ../../performance.rst:105 1d316c89fa5f472d84f7a20d58b8fde1
224226msgid "Smaller Code Size"
225227msgstr "更小的代码量"
226228
227- #: ../../performance.rst:107 f6916a6fa4394efba918e44564a3e3ff
229+ #: ../../performance.rst:107 f34ab763057a4b43b0f1bade1afa7381
228230msgid ""
229231"Embedded firmware may be limited in program size. Bitproto provides "
230232"another compiler option ``-F`` to filter messages to generate in "
231233"optimization mode:"
232234msgstr "嵌入式固件可能受限于编译后程序占用空间的大小。 bitproto 提供了一个编译器选项 ``-F`` 来筛选需要生成编解码函数的消息名字列表:"
233235
234- #: ../../performance.rst:114 3d205ab357e04f8898a9e40f1d21b450
236+ #: ../../performance.rst:114 fb8416a03ed146c38d4454addc9bd8e7
235237msgid ""
236238"The command above tells bitproto only to generate encoder and decoder "
237239"functions for message ``Packet``, other messages's encoder and decoder "
238240"functions will be skpped without generating."
239- msgstr "上面的命令中, bitproto 会只生成消息 ``Packet`` 的编码函数和解码函数,"
240- "其他消息的编码函数和解码函数则会跳过,不再生成。"
241+ msgstr "上面的命令中, bitproto 会只生成消息 ``Packet`` 的编码函数和解码函数,其他消息的编码函数和解码函数则会跳过,不再生成。"
241242
242- #: ../../performance.rst:117 42db4299999f440fa8b367d603a2bb80
243+ #: ../../performance.rst:117 01faf066ac364b6c8acf36119c102aa1
243244msgid ""
244245"The ``-F`` trick is useful because in most scenarios we just exchange a "
245246"single \" top-level\" bitproto message in communication. This option can "
246247"also be used with multiple message names:"
247- msgstr "``-F`` 选项之所以是有用处的,是因为在很多情况下,我们在通信过程中只交换一个\" 顶级的\" 消息。"
248- "这个选项也可以用来筛选多个消息名字,使用逗号分隔即可:"
248+ msgstr ""
249+ "``-F`` "
250+ "选项之所以是有用处的,是因为在很多情况下,我们在通信过程中只交换一个\" 顶级的\" 消息。这个选项也可以用来筛选多个消息名字,使用逗号分隔即可:"
249251
250- #: ../../performance.rst:124 a323b26bc7ad41b9b044a3b0a321a8b5
252+ #: ../../performance.rst:124 a86a675b7f454c49a77bb95f14710eed
251253msgid ""
252254"Finally to note that, the ``-F`` option can be only used together with "
253255"option ``-O``."
0 commit comments