PathKit icon indicating copy to clipboard operation
PathKit copied to clipboard

Why use NSString?

Open kateinoigakukun opened this issue 6 years ago • 3 comments

Thanks for useful library 😄

While investigating performance problem, I found this library converts Swift.String into NSString and it's very high cost operation.

Why this library uses NSString instead of implementing its own logic?

kateinoigakukun avatar Sep 16 '19 06:09 kateinoigakukun

If you look into code you see "expandingTildeInPath" which is defined in @interface NSString (NSStringPathExtensions). Code behind expandingTildeInPath is NSFileManager + NSHomeDirectory which use NSString. What is your solution/workaround?

xhruso00 avatar Oct 31 '19 17:10 xhruso00

I mean using these Obj-C API is convenient but high cost, so I prefer to implement the logics in pure Swift in aspect of performance.

It would be very valuable improvement because this library is used in many popular OSS 👍 If I can get agreements from this project author, I'll implement it.

kateinoigakukun avatar Nov 19 '19 23:11 kateinoigakukun

see https://github.com/kylef/PathKit/pull/72/files#r391294029 for some mitigation

michaeleisel avatar Mar 11 '20 22:03 michaeleisel