Hacker News new | past | comments | ask | show | jobs | submit | calrain's comments login

I'm doing the challenges in PowerShell to see how it goes.

I want to use it as a test to see how human programming can be improved by an AI, so I wrote the solution for day 1, got the right answer, and then gave my code to ChatGPT 4o to ask it to make the code faster.

My version ran in ~3500 ms ChatGPT's version ran in 140 ms

both worked

A great example of how a common DevOps language program can be improved on by ChatGPT.


That seems rather slow for yours, and not very fast for an optimised one. It can speed up a lot from a cold start to a warm run, my tuned code can show 8 ms in powershell 7.4 after a few runs.

My hack-it-out code: https://pastebin.com/PDQhxDc9

Faster code: https://pastebin.com/6xwaVkwq

The hacky code uses slower techniques like:

- Get-Content which adds metadata to every line.

- @() arrays with += which copies the array in memory to a new one-larger memory location for every addition.

- Pipeline overhead e.g. ForEach-Object and Measure-Object.

- Filtering the whole second column for each number in the first column, repeated wasted work.

and it's still in the region of your ChatGPT one.

The faster one addresses these with:

- ReadAllLines() .NET method to get plain strings.

- [system.collections.generic.list[int]]::new() which don't box integers and can grow more quickly.

- plain adding numbers into sum variables.

- Building a hashtable [system.collections.generic.dictionary[int, int]]::new() to count each number in the second column.

- Swapping -split for string split() which may have a tiny bit less overhead.

- no pipelines.

The code isn't completely different, it's the same blocks doing the same things, leaning more on .NET lower levels, and years of experience of the basic PowerShell performance hits.


The design of this vehicle is a case study in making something for the customer, rather than the Cybertruck's design approach of making something for Elon's ego.

Interestingly in China, pick-up truck has 15 years lifetime limit but not SUV. This vehicle is registered as an SUV although can function as pick-up truck thus it'll not has the limitation. I think this can also sell very well in Australia because pick-up truck is their favorite type of vehicle and this ute styled SUV can be a winner there.

Just some feedback on your landing page.

I have no idea what problem you're targeting, what your product is, or how I would use it.

Hit those three targets without someone scrolling below the fold.


This isn't a product landing page, nor am I affiliated with Monzo. It is a company policy page showing effective principles to communicate with customers.


I think that API URI naming conventions have impacted SQL table names.

It's common to have endpoints like `/customers` and `/customers/{id}` which has a tendency to move SQL table names to match the API endpoint.

I tend to name tables in the singular form if writing applications that interact directly with SQL tables, but where standing up a API in front of a SQL database, I tend to move to the plural naming of the table.

It helps to have the table 'customers' be associated with an API endpoint of the same name.


>> But that data is reasonably only accessible by the people who instrumented that tracking.

... and Google... and the people they sell aggregated traffic data to...

CloudFlare (e.g. NSA [joke!]) also gets a truckload of data from each web call, and your ISP, and the hosts of any <script> tags, and the image hosts, and all the engagement tracking plugins in your site...

The list is endless


Yeah, it’s not like Google spins up a separate DB for you when you sign up for Analytics – everything’s in one pile, ready to be mined for that sweet sweet user data. (That’s the reason there’s such a generous free tier for website owners, of course.)


From a market penetration perspective, FireFox is not winning, but as a worker in the Cyber Security space, almost all my peers use FireFox.


What is the risk of releasing the files, is it about to expose that the Rodin Museum has fakes?


100% stay away from it.

I think a better question is: "How can you ensure any VS Code extension is safe to use?"

Understanding exactly what an extension does and getting clarity around how it operates is something that I'd like to better understand as well.

It makes me think that moving to other editors like Neovim might be a safer way to go, if Microsoft has created an environment where malicious plug-ins can operate.


Thanks, yeah, I def won't install it.

Looks like there are some calls to `fs` and `path`, so it's definitely reading the file system, which could be legitimate, but yeah hard to say.

Kinda wild that simply installing an extension can give the author full access and there isn't really a way to verify extension code.

I mean even if they had linked a repo that actually contained code, how can I know that the code from the repo is actually the same that gets downloaded when the extension is installed?


This is one of places where Unions can help


No


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: