Skip to content

Wrapper to facilitate use of stream in qax-os/excelize

License

Notifications You must be signed in to change notification settings

tomtwinkle/excelizeam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

excelizeam

Wrapper to facilitate use of excelize.StreamWriter in qax-os/excelize

Motivation

excelize.StreamWriter in qax-os/excelize has been found to be able to write large amounts of data at high speed while reducing memory usage, and should be used aggressively, but its use is severely limited, and Excel itself will be damaged if the order of writes is incorrect.

Therefore, a Wrapper was created to automatically meet the restrictions.

When using SyncMethod such as SetCellValue(), there is no advantage in speed, but by using Async function such as SetCellValueAsync(), it is possible to achieve almost the same speed as excelize.StreamWriter.

qax-os/excelizeexcelize.StreamWriter は大量のデータをメモリ使用量を抑えつつ高速に書き込むことが出来る事が示されており積極的に利用したいが、利用する際の制限が厳しく書き込みの順番を間違えるとExcel自体が破損してしまうため、そのままでは使い所が難しい。

そのため制限を自動的に満たすためのWrapperを作成した。

SetCellValue() のようなSyncMethodを使用する場合は速度面でのメリットを享受出来ないが、 SetCellValueAsync() のようなAsync関数を利用することで excelize.StreamWriter とほぼ同様の速度を出すことが可能になる。

BenchmarkExcelizeam
BenchmarkExcelizeam/Excelize
BenchmarkExcelizeam/Excelize-12                  	       9	 124964492 ns/op
BenchmarkExcelizeam/Excelize_Async
BenchmarkExcelizeam/Excelize_Async-12   	               6	 208647106 ns/op
BenchmarkExcelizeam/Excelize_StreamWriter
BenchmarkExcelizeam/Excelize_StreamWriter-12         	      12	  89386412 ns/op
BenchmarkExcelizeam/Excelizeam_Sync
BenchmarkExcelizeam/Excelizeam_Sync-12               	       5	 232665514 ns/op
BenchmarkExcelizeam/Excelizeam_Async
BenchmarkExcelizeam/Excelizeam_Async-12              	      13	  86562598 ns/op

Usage

install your project

go get github.com/tomtwinkle/excelizeam@v0.3.4

TODO

About

Wrapper to facilitate use of stream in qax-os/excelize

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages