How to use Chat GPT in JavaScript optimizations for Node.js
1. How to use Chat GPT
in JavaScript optimizations for Node.js
Timur Shemsedinov
github.com/tshemsedinov
Chief Software Architect at Metarhia, CTO at Salucyber
Lecturer at Kiev Polytechnic Institute & Kiev School of Economics
2. Research approach
● Complex tasks: requires deep understanding of
JavaScript, Node.js, OOP, patterns, async, etc.
● Not common tasks: solutions can't be found
easily in the web
● Interesting and useful tasks: can be put into
practice
3. Research objectives
Find answers:
● Сan AI replace the developer (now, near future) ?
● What affects chat gpt code quality?
Learn how to...
● Prepare prompt for chat GPT
● Build a dialogue to get the desired result faster
4. Tasks
● Network protocol (over websocket) streaming
chunk encode/decode with typed arrays
● Promise chain and async I/O code optimization
for reading app configuration with defaults
● Buffer prefetcher for generation cryptographically
strong pseudorandom numbers
5. Conclusions
● As of now Chat GPT requires detailed prompt
● Preparing such a prompt takes a lot of time and
requires high knowledge comparable to the
manual optimization
● Version 3.5 and 4 gives almost equal bad result
with short prompt and almost equal good result
with detailed prompt
6. Links
● Chunk encode/decode with typed arrays:
https://github.com/HowProgrammingWorks/ChatGPT/tree/main/JavaScript/1-Chunk
● Promise chain and async code optimization:
https://github.com/HowProgrammingWorks/ChatGPT/tree/main/JavaScript/2-Promise
● Crypto random prefetcher:
https://github.com/HowProgrammingWorks/ChatGPT/tree/main/JavaScript/3-Prefetcher