sscanf() 與 strlen() 的故事繼續發展
sscanf() 與 strlen() 的故事繼續發展
昨天在「GTA 的啟動讀取效能問題」這邊提到了 sscanf() 與 strlen() 的問題,剛剛在 Hacker News Daily 上又看到一篇「It Can Happen to You」,在講他自己的專案也中獎。 他提到了一個解法,用 strtof() 取代 sscanf() 讀數字,結果大幅降低了 parsing 的時間: Replacing the sscanf call with strtof improved startup by nearly a factor of 10: from 1.8 seconds to 199 milliseconds. 文章的最後面題到了不少目前正在進行中的討論與 patch。 首先是 FreeBSD 上的 patch 已經在測試:「address a performance problem w/ partial sscanf on…
View On WordPress














