with
with
code block, whenever you update any aspect of a dataset, the update is immediately pushed to the dataset's long-term storage location. Due to the sheer number of discreet write operations, there may be a significant increase in runtime. In the example below, an update is pushed to AWS S3 for every call to the .append()
command inside of the for
loop.with
with
syntax below significantly improves performance because it only pushes updates to long-term storage after the code block inside the with
statement has been executed, or when the local cache is full. This significantly reduces the number of discreet write operations, thereby increasing the speed by up to 100X.