|
3 | 3 | Goal |
4 | 4 | ---- |
5 | 5 |
|
6 | | -This librairy helps you to write Excel files (`xlsx`) as fast as possible without, hopefully, blowing your heap. |
| 6 | +This library helps you write Excel files (`xlsx`) as fast as possible without, hopefully, blowing your heap. |
7 | 7 |
|
8 | 8 | It's meant to be used in JRuby programs. |
9 | | -It can be used in Scala programs, of course, but there're better, pure, ways with such language to achieve the same goal. |
| 9 | +It can be used in Scala programs, of course, but there are better, pure, ways with such language to achieve the same goal. |
10 | 10 |
|
11 | | -It's a very opinionated librairy which does not provides you all the possible customizations. |
12 | | -For example, it'll use all your CPU cores to compute the rows, it's not configurable and will maybe never be. |
| 11 | +It's a very opinionated library that does not provide all the possible customizations. |
| 12 | +For example, it'll use all your CPU cores to compute the rows. It's not configurable and may never be. |
13 | 13 |
|
14 | 14 | Be sure to read and understand the [heap usage considerations](#heap-usage-considerations) and [CPU usage considerations](#cpu-usage-considerations) |
15 | 15 | chapters of this README before using this lib in a production environment. |
@@ -37,7 +37,7 @@ java_import 'com.colisweb.jruby.concurrent.constant.memory.excel.Cell' |
37 | 37 | header = ["A", "B", "C"].to_java(:string) |
38 | 38 | sheet_name = "cars" |
39 | 39 |
|
40 | | -# Curently, support only one sheet per workbook. |
| 40 | +# Currently, only one sheet per workbook is supported. |
41 | 41 | # |
42 | 42 | workbook_state = ConcurrentConstantMemoryExcel.newWorkbookState(sheet_name, header) |
43 | 43 |
|
@@ -74,64 +74,59 @@ queries.each_with_index { |query, index| |
74 | 74 |
|
75 | 75 | compute_rows_lambda = to_parametrize_compute_rows_lambda.call(query) |
76 | 76 |
|
77 | | - # Do not launch any computation. It just registers required computations in the `workbook_state`. |
| 77 | + # Does not launch any computation. It just registers required computations in the `workbook_state`. |
78 | 78 | # |
79 | 79 | # The second argument for this function call should be a lambda taking no parameter. |
80 | 80 | # |
81 | 81 | ConcurrentConstantMemoryExcel.addRows(workbook_state, compute_rows_lambda, index.to_java(:int)) |
82 | 82 |
|
83 | 83 | } |
84 | 84 |
|
85 | | -# Computations of rows will really begin with this function call. Not before. |
| 85 | +# Computation of rows will really begin with this function call. Not before. |
86 | 86 | # |
87 | 87 | ConcurrentConstantMemoryExcel.writeFile(workbook_state, "path/to/my/file") # will write a file named `file.xlsx` in the `path/to/my` directory. |
88 | 88 | ``` |
89 | 89 |
|
90 | 90 | Heap usage considerations |
91 | 91 | ------------------------- |
92 | 92 |
|
93 | | -This librairy parallelizes the computations of your rows using `n` threads, where `n` is the number of cores your CPU has. |
| 93 | +This library parallelizes the computation of your rows using `n` threads, where `n` is the number of cores your CPU has. |
94 | 94 |
|
95 | 95 | For each call to the `addRows` function, a computation is registered in the `workbook_state`. |
96 | 96 |
|
97 | 97 | When the `writeFile` function is called, all the registered computations will be launched, `n` by `n`. |
98 | 98 |
|
99 | | -So the maximum quantity of RAM this lib can use is equal to `n` times the quantity of RAM required to compute the `compute_rows_lambda`. |
| 99 | +So the maximum amount of RAM this lib can use is equal to `n` times the amount of RAM required to compute the `compute_rows_lambda`. |
100 | 100 |
|
101 | | -If your program OOM, the only way to fix that is by reducing the size of the result the `query` passed to the `parametrized_compute_rows_lambda` gives you when executed. |
| 101 | +If your program OOMs, the only way to fix that is by reducing the size of the result the `query` passed to the `parametrized_compute_rows_lambda` gives you when executed. |
102 | 102 |
|
103 | 103 | CPU usage considerations |
104 | 104 | ------------------------- |
105 | 105 |
|
106 | | -Because this lib knows nothing about the computations you'll ask it to execute, in order to maximise the CPU usage, |
107 | | -and so the speed of your Excel extraction, you'll have to ensure that the number of registered computations (number of call to the `addRows` function) |
108 | | -is superior or equal to the number of cores your CPU has. |
| 106 | +Because this lib knows nothing about the computations you'll ask it to execute, in order to maximise CPU usage |
| 107 | +and therefore the speed of your Excel extraction, you'll have to ensure that the number of registered computations (number of calls to the `addRows` function) |
| 108 | +is greater than or equal to the number of cores your CPU has. |
109 | 109 |
|
110 | | -If it's inferior to that number, maybe you can write your `queries` in a different way. |
| 110 | +If it's fewer than that number, you may be able to write your `queries` in a different way. |
111 | 111 |
|
112 | | -For example, instead of making 4 `query` each computing `1000` rows, you can write 8 `query` computing `500` rows. |
113 | | -On a 8 cores machines, the result can be computed up to 2 times faster in this case. |
| 112 | +For example, instead of making 4 queries each computing `1000` rows, you can write 8 queries computing `500` rows. |
| 113 | +On an 8-core machine, the result can be computed up to 2 times faster in this case. |
114 | 114 |
|
115 | 115 | Coding Style |
116 | 116 | ------------ |
117 | 117 |
|
118 | | -This project is a Scala librairy meant to be used in JRuby projects. |
| 118 | +This project is a Scala library meant to be used in JRuby projects. |
119 | 119 |
|
120 | 120 | *That explains the quite impure style used in the Scala code.* |
121 | 121 |
|
122 | 122 | Acknowledgments |
123 | 123 | --------------- |
124 | 124 |
|
125 | | -We want to thanks: |
| 125 | +We want to thank: |
126 | 126 |
|
127 | 127 | - Nicolas Rinaudo [@NicolasRinaudo](https://twitter.com/NicolasRinaudo) |
128 | 128 | - Elijah Rippeth [@terrible_coder](https://twitter.com/terrible_coder) |
129 | 129 | - Mathieu Besançon [@matbesancon](https://twitter.com/matbesancon) |
130 | 130 | - Charles Oliver Nutter [@headius](https://twitter.com/headius) |
131 | 131 |
|
132 | | -for their help in the writting of this lib. |
133 | | - |
134 | | -🙂 |
135 | | - |
136 | | - |
137 | | - |
| 132 | +for their help in writing this lib. |
0 commit comments