Post

Replies

Boosts

Views

Activity

Reply to Swift Regex too slow als grep replacement?
$0.contains(yesterdayRegEx) Did you also change the definition of the regex to remove the Capture { } ? I removed the filter to get a clue how much time the spilt needs. It is about 50 s! Right. It's important to know what is actually slow, first! My Swift is poor. (I'm really a C++ person). But clearly you don't actually need to create new strings for each individual line of the input. I'm not sure what the best, i.e. most idiomatic, way to do that is in Swift. Maybe someone else will comment.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to Swift Regex too slow als grep replacement?
One thing to note is that your shell script includes significant concurrency; the five processes will run at the same time on different processors. Your swift code does everything sequentially on one processor. I don't know how significant that is compared to other factors. How quick is the swift code without the actual regex testing, i.e. how quickly can it read the file, split into lines and count the lines?
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to Struct with an 'expiry date' - how to create elegantly?
I am trying to create a struct which contains a value along with an 'expiry time' That's straightforward. But it doesn't seem to be what you are actually doing. What you actually seem to have implemented is a struct (or class) containing a timer. Don't do that, just store the expiry time. Then in your is_new getter, compare the expiry time with the current time. (Do you have some other reason for wanting to store the timer in the object?)
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to Debugging API JWT authorization problems - any suggestions?
Just in case this is ever useful to anyone in the future.... My bug was that I was using DER-encoded bytes in the JWT signature, not raw bytes. Specifically, if you look at the source of the Ruby JWT encoder used by Apple in their 2018 WWDC presentation, it has a function called asn1_to_raw that converts the result of the OpenSSL::Digest call to raw bytes. The surprising thing is that my code using the DER-encoded version works for the App Attest API !!! What I don't know is whether that API requires DER-encoded data, or whether it accepts both.
Jun ’23
Reply to Fake Downloads Attempting to Take Down my App
it’s possible that there are instances where you're being outbid by other advertisers interested in showing their ad for that same keyword. Yes, this. I am buried presumably because of these attacks, and not because I don't spend enough on Search Ads. You might be right, but don't rule out the possibility that other developers are just spending more than you. In my experience for my apps, the recommended max bids for app store ads are always way above the profit that I could ever make from the sales. I attribute this to my competitors bidding more than they should for ads. I have maybe a dozen direct competitors (*) and there always seems to be one whose business model is to pay whatever it takes to get users even at a loss, with the idea that as a result their app will "go viral" and they will start to make a profit in the future. What actually happens is that they burn through their capital and go out of business. I guess you have a lot more competitors than I do; if there are 1000 people bidding for "chess", it only takes a couple to offer ridiculous bids and everyone else will be lost. I don't know the solution to this; my advice to anyone with a new app idea would be that they need to have a well-researched and realistic marketing plan before they waste time creating an app that won't sell. (Maybe some developers have a "well-researched and realistic marketing plan" which involves fraudulently boosting their app's ratings and damaging their competitors' stats....) (*) I say "competitors", but actually I think a lot of users end up buying several of the available apps. I don't think of these other apps as competitors in the traditional sense.
Jun ’23
Reply to Swift Regex too slow als grep replacement?
You need a Swift expert to understand that. You need, somehow, to avoid allocating memory for and copying strings for every line. Or alternatively, create a regex you can apply to the entire input, which matches just the bits you want but captures the entire line. Then you wouldn't need to split.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Swift Regex too slow als grep replacement?
$0.contains(yesterdayRegEx) Did you also change the definition of the regex to remove the Capture { } ? I removed the filter to get a clue how much time the spilt needs. It is about 50 s! Right. It's important to know what is actually slow, first! My Swift is poor. (I'm really a C++ person). But clearly you don't actually need to create new strings for each individual line of the input. I'm not sure what the best, i.e. most idiomatic, way to do that is in Swift. Maybe someone else will comment.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Swift Regex too slow als grep replacement?
One thing to note is that your shell script includes significant concurrency; the five processes will run at the same time on different processors. Your swift code does everything sequentially on one processor. I don't know how significant that is compared to other factors. How quick is the swift code without the actual regex testing, i.e. how quickly can it read the file, split into lines and count the lines?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Struct with an 'expiry date' - how to create elegantly?
I am trying to create a struct which contains a value along with an 'expiry time' That's straightforward. But it doesn't seem to be what you are actually doing. What you actually seem to have implemented is a struct (or class) containing a timer. Don't do that, just store the expiry time. Then in your is_new getter, compare the expiry time with the current time. (Do you have some other reason for wanting to store the timer in the object?)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Debugging API JWT authorization problems - any suggestions?
Just in case this is ever useful to anyone in the future.... My bug was that I was using DER-encoded bytes in the JWT signature, not raw bytes. Specifically, if you look at the source of the Ruby JWT encoder used by Apple in their 2018 WWDC presentation, it has a function called asn1_to_raw that converts the result of the OpenSSL::Digest call to raw bytes. The surprising thing is that my code using the DER-encoded version works for the App Attest API !!! What I don't know is whether that API requires DER-encoded data, or whether it accepts both.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Fake Downloads Attempting to Take Down my App
it’s possible that there are instances where you're being outbid by other advertisers interested in showing their ad for that same keyword. Yes, this. I am buried presumably because of these attacks, and not because I don't spend enough on Search Ads. You might be right, but don't rule out the possibility that other developers are just spending more than you. In my experience for my apps, the recommended max bids for app store ads are always way above the profit that I could ever make from the sales. I attribute this to my competitors bidding more than they should for ads. I have maybe a dozen direct competitors (*) and there always seems to be one whose business model is to pay whatever it takes to get users even at a loss, with the idea that as a result their app will "go viral" and they will start to make a profit in the future. What actually happens is that they burn through their capital and go out of business. I guess you have a lot more competitors than I do; if there are 1000 people bidding for "chess", it only takes a couple to offer ridiculous bids and everyone else will be lost. I don't know the solution to this; my advice to anyone with a new app idea would be that they need to have a well-researched and realistic marketing plan before they waste time creating an app that won't sell. (Maybe some developers have a "well-researched and realistic marketing plan" which involves fraudulently boosting their app's ratings and damaging their competitors' stats....) (*) I say "competitors", but actually I think a lot of users end up buying several of the available apps. I don't think of these other apps as competitors in the traditional sense.
Replies
Boosts
Views
Activity
Jun ’23