-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
胜者是 Stream:NodeJS 读取大数据集合几种方法的性能比较 #6264
胜者是 Stream:NodeJS 读取大数据集合几种方法的性能比较 #6264
Conversation
update origin forks
* Finish translation * Modify translation in code comments * Fix format and delete original paragraphs * Resolve modification suggestions * Remove an extra empty line * Update micro-frontends-2.md
* Create kotlin-clean-architecture.md * Update kotlin-clean-architecture.md * Update kotlin-clean-architecture.md
* 翻译部分文章 * Xcode 和 LLDB 高级调试教程:第 2 部分 * 参考 iWeslie 和 JasonWu1111 的校对意见进行校对,并添加校对名单 * 格式细节修改 * Update xcode-and-lldb-advanced-debugging-tutorial-part-2.md
* 垂直排版:重提� writing-mode 垂直排版:重提� writing-mode * fix fix * 根据校对意见修改 根据校对意见修改 * fix 作品链接 * translate * 根据校对意见修改
* 自托管你的静态资源 自托管你的静态资源 * update 自托管你的静态资源 update 自托管你的静态资源 * Update self-host-your-static-assets.md * Update self-host-your-static-assets.md 数字/英文间加空格 * 格式问题修正
* Update micro-frontends-3.md 完成翻译 * Update micro-frontends-3.md 根据校对者意见修改完成 * Update micro-frontends-3.md
* 流式字体排版的现状 * accessibility 释义修改 * 统一翻译为流式文字排版 * 格式调整 * 校对修改 * Update the-state-of-fluid-web-typography.md
* Update promoting-install-mobile.md 翻译完成 * 推广 PWA 安装的模式(移动端) 翻译完成 * 推广 PWA 安装的模式(移动端) 翻译完成 * Update promoting-install-mobile.md * 校对修改完成 校对修改完成 * Update promoting-install-mobile.md 添加校对者
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
翻译幸苦了,提了一些建议
|
||
![](https://cdn-images-1.medium.com/max/2000/1*fsseXIPGEhwmg6kfgXyIjA.jpeg) | ||
|
||
If you’ve been keeping up with my writing, a few weeks ago, I published a [blog](https://itnext.io/using-node-js-to-read-really-really-large-files-pt-1-d2057fe76b33) talking about a variety of ways to use Node.js to read really large datasets. | ||
如果你最近都在阅读我的文章,你应该会看到我几周前发布的一篇[博客](https://itnext.io/using-node-js-to-read-really-really-large-files-pt-1-d2057fe76b33),这篇博客讨论了使用 Node.js 来读取大型数据集的各种方法。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[如果你最近都在阅读我的文章] -> [如果你一直在关注我的文章]
|
||
As I worked towards my ultimate end goal of processing a large dataset, I came up with three solutions in Node.js. | ||
当我努力去实现处理大型数据集这个目标的过程中,我在 Node.js 中提出了三个解决方案。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【提出】-》【想到】
|
||
In the end, I came up with only one solution in Node.js that was able to handle the full 2.55GB file I wanted to parse through, at one time. | ||
最后,我在 Node.js 中提出了唯一能够处理完整的 2.55 GB 的文件的解决方案。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【提出】-》【想到】
|
||
Below are code snippets implementing `console.time()` and `performance-now` in each of my scripts. These are only snippets of one function each — for the full code, you can see my repo [here](https://github.com/paigen11/file-read-challenge). | ||
下面是我在每个脚本中接入 `console.time()` 以及 `performance-now` 的代码片段。这些代码只是每个函数的片段 - 相对于完整代码来说,你可以在[这里](https://github.com/paigen11/file-read-challenge)查看我的代码仓库。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【相对于完整代码来说】-》【如果你想看全套代码】
异译会好一些
|
||
![](https://cdn-images-1.medium.com/max/2568/1*n48UZ77lvktwjN6IDR0x1g.png) | ||
|
||
Since this script is using the `fs.readFile()` implementation, where the entire file is read into memory before any functions are executed on it, this is the most synchronous-looking code. It’s not actually synchronous, that’s an entirely separate Node method called `fs.readFileSync()`, it just resembles it . | ||
由于这个脚本使用 `fs.readFile()` 实现,整个文件都会在执行函数之前被读取到内存中,看起来这是最同步的代码。但是它实际上不是同步的,同步地读取文件在 Node 中有一个专用的方法,叫做 `fs.readFileSync()`,两者看起来很相似。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【看起来这是最同步的代码】-》【这看起来很想同步代码】
觉得直接翻译有点奇怪
|
||
In the end, streams both native to Node.js and not, are way, WAY more efficient at processing large data sets. | ||
最后,Node.js 原生的流和非原生的流,在处理大型数据集的时候会更加有效。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【Node.js 原生的流和非原生的流】-》【流式处理,不论是Node.js 原生还是非原生的】
校对认领 |
@Ultrasteve 好的呢 🍺 |
校对认领 |
@xilihuasi 妥妥哒 🍻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LucaslEliane @Glowin 校对完成
|
||
I won’t go into the specifics of the challenge and solution, because you can read my first post for all the details [here](https://itnext.io/using-node-js-to-read-really-really-large-files-pt-1-d2057fe76b33), but I will give you the high level overview. | ||
我不会详细介绍上一篇博客中的挑战和解决方案,因为你可以去阅读我的第一篇文章,了解所有的细节[这里](https://itnext.io/using-node-js-to-read-really-really-large-files-pt-1-d2057fe76b33),但是我会给你进行一下简单的介绍。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
#### The Three Different Solutions Possible For Smaller Datasets | ||
#### 三种解决方案与小数据集情况下的不同点 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
三种解决方案与小数据集情况下的不同点
=>
三种小数据集场景下的解决方案
``` | ||
|
||
That’s one method I used to figure out how long it took to process the dataset. | ||
这是我用来计算处理数据集所需要的时间的一种方法。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是我用来计算处理数据集所需要的时间的一种方法。
=>
这是我用来计算处理数据集所需时间的一种方法。
…-for-reading-large-datasets-pt-2.md
@xilihuasi @Ultrasteve 感谢二位细心校对,已按照二位校对意见修改译文 |
@xilihuasi @Ultrasteve 麻烦二位检查一下修改后的译文是否还有译错之处~ 感谢 |
@@ -48,7 +48,7 @@ | |||
|
|||
**解决方案 3:[`event-stream`](https://www.npmjs.com/package/event-stream)** | |||
|
|||
最后,我在 Node.js 中提出了唯一能够处理完整的 2.55 GB 的文件的解决方案。 | |||
最后,我在想到了 Node.js 中唯一能够处理完整的 2.55 GB 的文件的解决方案。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我在想到了 => 我想到了在
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改 感谢
…-for-reading-large-datasets-pt-2.md
@xilihuasi @Ultrasteve 感谢校对,已按照意见进行修改~ 如没有其他问题,请麻烦 approve 一下~ |
@LucaslEliane 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。 掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件。 |
译文翻译完成,resolve #6046