c ++中文件处理操作背后的内存操作

时间:2016-01-04 08:34:08

标签: c++ memory-management file-handling

L = [np.random.standard_normal(size=(x, n)).astype(dtype) for x in range(min_x, number_of_matrices + min_x)] dtype = 'float32' theano.config.floatX = dtype iteration_count = 10 min_x = 20 # base case: # numpy_version1 0.100589990616 # theano_version1 0.243968963623 # theano_version2 0.198153018951 number_of_matrices = 200 n = 100 # increase matrix size: # numpy_version1 4.90120816231 # theano_version1 0.984472036362 # theano_version2 3.56008815765 number_of_matrices = 200 n = 1000 # increase number of matrices: # numpy_version1 5.11445093155 # theano_version1 compilation error # theano_version2 6.54448604584 number_of_matrices = 2000 n = 100
在上面的代码片段中,整个“file1.txt”是从辅助内存加载到RAM中的,还是仅在我实现了ifstream f1; f1.open("file1.txt");这样的操作之后才进行此转移?

1 个答案:

答案 0 :(得分:2)

你只创建一个处理程序。读取数据是将文件加载到内存中的原因