freemyipod r644 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r643‎ | r644 | r645 >
Date:22:47, 22 February 2011
Author:theseven
Status:new
Tags:
Comment:
emcore.py: Align disk access buffers. This greatly speeds up transferring of large files
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -886,7 +886,7 @@
887887 storageinfo = self.emcore.storage_get_info(volume)
888888 buffsize = min(buffsize, storageinfo.sectorsize * count)
889889 if buffer is None:
890 - buffer = self.emcore.malloc(buffsize)
 890+ buffer = self.emcore.memalign(0x10, buffsize)
891891 malloc = True
892892 else:
893893 buffer = to_int(buffer)
@@ -924,7 +924,7 @@
925925 storageinfo = self.emcore.storage_get_info(volume)
926926 buffsize = min(buffsize, storageinfo.sectorsize * count)
927927 if buffer is None:
928 - buffer = self.emcore.malloc(buffsize)
 928+ buffer = self.emcore.memalign(0x10, buffsize)
929929 malloc = True
930930 else:
931931 buffer = to_int(buffer)
@@ -1022,7 +1022,7 @@
10231023 size = self.emcore.file_size(fd)
10241024 buffsize = min(buffsize, size)
10251025 if buffer is None:
1026 - buffer = self.emcore.malloc(buffsize)
 1026+ buffer = self.emcore.memalign(0x10, buffsize)
10271027 malloc = True
10281028 else:
10291029 buffer = to_int(buffer)
@@ -1055,7 +1055,7 @@
10561056 handle = self.emcore.dir_open(remotepath)
10571057 try:
10581058 if buffer is None:
1059 - buffer = self.emcore.malloc(buffsize)
 1059+ buffer = self.emcore.memalign(0x10, buffsize)
10601060 malloc = True
10611061 else:
10621062 buffer = to_int(buffer)
@@ -1094,7 +1094,7 @@
10951095 try:
10961096 buffsize = min(buffsize, os.path.getsize(localname))
10971097 if buffer is None:
1098 - buffer = self.emcore.malloc(buffsize)
 1098+ buffer = self.emcore.memalign(0x10, buffsize)
10991099 malloc = True
11001100 else:
11011101 buffer = to_int(buffer)
@@ -1107,6 +1107,7 @@
11081108 data = f.read(buffsize)
11091109 if len(data) == 0: break
11101110 self.emcore.write(buffer, data)
 1111+ self.emcore.write(buffer, data)
11111112 bytes = 0
11121113 while bytes < len(data):
11131114 bytes = bytes + self.emcore.file_write(fd, len(data) - bytes, buffer + bytes)
@@ -1130,7 +1131,7 @@
11311132 """
11321133 buffsize = to_int(buffsize)
11331134 if buffer is None:
1134 - buffer = self.emcore.malloc(buffsize)
 1135+ buffer = self.emcore.memalign(0x10, buffsize)
11351136 malloc = True
11361137 else:
11371138 buffer = to_int(buffer)