add big file test to cellfs
This commit is contained in:
@@ -5,6 +5,7 @@ var cellfs = use('cellfs')
|
||||
var io = use('io')
|
||||
var time = use('time')
|
||||
var json = use('json')
|
||||
var blob = use('blob')
|
||||
|
||||
log.console("CellFS vs IO Performance Test")
|
||||
log.console("=================================")
|
||||
@@ -32,7 +33,7 @@ for (var i = 0; i < io_paths.length; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
io.slurpwrite(test_content, test_file)
|
||||
io.slurpwrite(test_file, test_content)
|
||||
|
||||
// Verify both systems have the same search paths
|
||||
log.console(`IO search paths: ${json.encode(io.searchpath())}`)
|
||||
@@ -136,9 +137,43 @@ log.console(`CellFS ZIP read (100 iterations): ${cellfs_time}ms`)
|
||||
speedup = io_time / cellfs_time
|
||||
log.console(`CellFS is ${speedup.toFixed(2)}x ${speedup > 1 ? "faster" : "slower"} than IO for ZIP reading`)
|
||||
|
||||
// Test large file operations
|
||||
log.console("\nTesting large file operations...")
|
||||
|
||||
var large_file = "large_test.bin"
|
||||
var size_mb = 10
|
||||
var size_bits = size_mb * 1024 * 1024 * 8
|
||||
log.console(`Creating ${size_mb}MB large file...`)
|
||||
|
||||
var blob = new blob(size_bits, function() { return Math.floor(Math.random() * (1 << 52)) })
|
||||
stone(blob)
|
||||
io.slurpwrite(large_file, blob)
|
||||
|
||||
log.console("Testing large file reading...")
|
||||
|
||||
// Test io.slurpbytes
|
||||
start_time = time.number()
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var large_content = io.slurpbytes(large_file)
|
||||
}
|
||||
io_time = time.number() - start_time
|
||||
log.console(`IO large file read (10 iterations): ${io_time}ms`)
|
||||
|
||||
// Test cellfs.slurpbytes
|
||||
start_time = time.number()
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var large_content = cellfs.slurpbytes(large_file)
|
||||
}
|
||||
cellfs_time = time.number() - start_time
|
||||
log.console(`CellFS large file read (10 iterations): ${cellfs_time}ms`)
|
||||
|
||||
speedup = io_time / cellfs_time
|
||||
log.console(`CellFS is ${speedup.toFixed(2)}x ${speedup > 1 ? "faster" : "slower"} than IO for large file reading`)
|
||||
|
||||
// Cleanup
|
||||
//io.rm(test_file)
|
||||
//io.rm("test_archive.zip")
|
||||
io.rm(test_file)
|
||||
io.rm("test_archive.zip")
|
||||
io.rm(large_file)
|
||||
//io.unmount("/test_zip")
|
||||
//cellfs.unmount("/test_zip")
|
||||
|
||||
@@ -152,3 +187,5 @@ for (var path of io_paths) {
|
||||
}
|
||||
|
||||
log.console("\nTest completed!")
|
||||
|
||||
$_.stop()
|
||||
Reference in New Issue
Block a user