惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Cyberwarzone
Cyberwarzone
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
小众软件
小众软件
Recent Announcements
Recent Announcements
博客园 - 三生石上(FineUI控件)
Security Archives - TechRepublic
Security Archives - TechRepublic
W
WeLiveSecurity
Cloudbric
Cloudbric
博客园 - 司徒正美
美团技术团队
N
News and Events Feed by Topic
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
PCI Perspectives
PCI Perspectives
宝玉的分享
宝玉的分享
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
Last Week in AI
Last Week in AI
S
Schneier on Security
N
News | PayPal Newsroom
B
Blog RSS Feed
L
LINUX DO - 最新话题
T
Troy Hunt's Blog
S
Secure Thoughts
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
L
Lohrmann on Cybersecurity
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tenable Blog
S
Securelist
L
LangChain Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
I
InfoQ
H
Heimdal Security Blog
Cisco Talos Blog
Cisco Talos Blog
F
Full Disclosure
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
K
Kaspersky official blog
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
C
Cisco Blogs

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor GitHub - GenAI-Gurus/awesome-eu-ai-act: Curated tools, official sources, OSS, templates, and guides for EU AI Act compliance. Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders How to Switch AI Chatbots and Why You Might Want To GitHub - MattMessinger1/agentic_refund_guardrail: Safe refund policy layer for AI agents — Python + TypeScript. Same behavior, shared tests. Adam/papers/emergent_values_whitepaper.md at master · strangeadvancedmarketing/Adam Ask HN: How do you stop playing 20 questions with your AI coding tools How far can automation and AI support psychotherapy? - @theU GitHub - stagas/rtdiff: realtime git diff gui and AI-assisted commits A Mac Studio for Local AI — 6 Months Later A History of the Early Years of AI at the University of Edinburgh Why AI Coding Tools Still Feel Stuck on Localhost MSN AI Datacenters Are Becoming Strategic Targets twitter.com Penn Researchers Use AI to Surface Unreported GLP-1 Side Effects in Reddit Posts Show HN: MoodSense AI (ML and FastAPI and Gradio, Deployed on Hugging Face) Moodsense Ai - a Hugging Face Space by aman179102 AI models are terrible at betting on soccer—especially xAI Grok GitHub - xialeistudio/echoic GitHub - HimashaHerath/github-dev-wrapped: AI-powered weekly GitHub activity reports deployed to GitHub Pages GitHub - alejandrobalderas/claude-code-from-source: Architecture, patterns & internals of Anthropic's AI coding agent — reverse-engineered from source maps AI and Tech brief: Ireland ascendant GitHub - Titovilal/context0: Context0 - Never Surrender Training for a Marathon with an AI Coach: What Worked and What Didn't Cyber Pulse: Agentic Intel - Apps on Google Play I Built an AI PR Reviewer That Catches Bugs by Not Looking for Bugs Gen Z workers are so fearful AI will take their job they’re intentionally sabotaging their company’s AI rollout | Fortune How AI Is Reimagining the Game of Golf–For Both Players and Courses GitHub - nattergabriel/reseed: A CLI tool for managing and distributing agent skills across projects Is SVG the final frontier? My AI workflow evolved from prompts to a near-autonomous workflow MLSharp Help - 3DGS Viewer & Generator I put my cognitive field based AI's runtime on GitHub Is Numble the first AI-proof game? A3: Kubernetes for autonomous AI agent fleets | Emergent Principles Deepali Vyas ("The Elite Recruiter") GitHub - msmarkgu/RelayFreeLLM: A restful API designed to route user prompts to various AI model providers. Unionized ProPublica staff are on strike over AI, layoffs, and wages Unleashing the Advantage of Quantum AI We're heading for an AI-fueled 'dementia crisis,' brain scientist warns The AI-Assisted Breach of Mexico's Government Infrastructure [pdf] GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. MSN GitHub - visionscaper/collabmem: Enabling long-term collaboration with Agentic AI - building up episodic and world model memory over time with in-context awareness We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs AI Code is Hollowing Out Open Source, and Maintainers are Looking the Other Way What leaked "SteamGPT" files could mean for the PC gaming platform's use of AI AI is the boss at this retail store. What could go wrong? GitHub - Wuzu11517/agentic-proxy: Local proxy meant to help reduce With Drones, Geophysics and ArtificiaI Intelligence, Researchers Prepare to Do Battle Against Land Mines A Single Operator, Two AI Platforms, Nine Government Agencies: The Full Technical Report 在 Steam 上购买 FriedrichAI: Offline AI 立省 10% GitHub - inevolin/resume-cli: Hit Claude usage limits? Resume any AI coding session elsewhere. Switch tools at zero friction. GitHub - atripati/ark: AI Runtime Kernel — a context operating system for AI agents. Eliminates tool bloat, loads only what’s needed, and gives LLMs their reasoning space back. How to Build a Secure AI PR Reviewer with Claude, GitHub Actions, and JavaScript This Startup Wants You to Pay Up to Talk With AI Versions of Human Experts Intel Arc Pro B70 Brings 32GB VRAM to Local AI for $949 WordPress 7.0: The Good, the AI, and the Still Missing AI on the couch: Anthropic gives Claude 20 hours of psychiatry IatroBench: Pre-Registered Evidence of Iatrogenic Harm from AI Safety Measures AI Agents Know About Supabase. They Don't Always Use It Right. The history and future of AI at Google, with Sundar Pichai Inside an AI‑enabled device code phishing campaign How Meta Used AI to Map Tribal Knowledge in Large-Scale Data Pipelines AI for Systems: Using LLMs to Optimize Database Query Execution Forecasting the Economic Effects of AI Introducing Tinker: Play with AI, bring your ideas to life AI sheds light on an ancient gaming mystery People really hate AI but not as much as Iran—or Democrats | Fortune What is an AI Product Engineer? Phoebe Gates wants her $185 million AI startup to succeed with 'no ties to my privilege or my last name': 'I have a chip on my shoulder' | Fortune
Relentlessly optimizing code with AI - Spectral Core Blog
metadata · 2026-05-19 · via Hacker News - Newest: "AI"

Damir Bulic Damir Bulic

18 May 2026

- 7 min read

Our SQL parsers are among the fastest, if not the fastest, in the world. Once you have something highly optimized, it's very hard to get further tangible gains. Yet I managed to double their speed, and I wouldn't have been able to do so without AI. For the not-so-optimized code, the gains were incredible. Binding is now up to 100x faster and memory consumption down by up to 60x.

I just checked the impact on SQL Tran and it now takes 20 seconds to parse SQL, perform a static analysis pass, and translate full 2.7 million SLOC Oracle schema to Postgres.

The table below shows timing and memory of two of our subsystems:

  1. Parser: building an in-memory semantic model from the SQL text)
  2. Binder: part of static analysis that resolves every identifier (name), exposing broken references and telling you "what's what"

What's measured in the table is parsing and binding of following statements:

  • SIMPLE: 120 character SELECT (3 lines, 2-table join)
  • MEDIUM: 800 character, 14-line SELECT (4-way join + GROUP BY + ORDER BY)
  • COMPLEX: 6300 character, 208-line SELECT (CTEs, recursive CTE, window, lateral, JSONB, etc.)

We have very complete parsers for all major SQL dialects (SQL Server, Oracle, MySQL, Postgres, and more) which matters because, the larger the SQL surface area, the slower the parser. SQL is somewhat ambiguous language and each dialect adds its own quirks. So having a 3-line SELECT statement parse in a single microsecond is a very good outcome. Also, these are not hand-written parsers, they are generated.

If I was able to write a parser generator able to achieve 2 microseconds per parse, why wouldn't I be able to double that speed without AI? Simply, I just wouldn't have the time and the energy to do it. Many of the optimizations I made now were on my bucket list for years. There are always more pressing things and there is a ton of code. Per-database SQL dialects are enormous, so if you want to change something, you will potentially have to touch up a ton of code.

Having your own parser generator instead of using ANTLR (for example) allows you to tweak things to your specific requirements instead of settling for something that works for a wide variety of use-cases you aren't interested in and is therefore pretty slow.

Some of the techniques in the optimization pass (we're using .NET, by the way):

  • Lexer (tokenizer) was fast but wasn't optimized for SIMD. As .NET has great improvements in this area, I focused on this and it paid off.
  • Of course, any allocations were replaced with spans, where appropriate.
  • For context, SQL statements are represented as AST (abstract syntax tree). Basically, each statement is a node, each clause is a child node, and recursively off you go. I had a ton of lists/arrays inside that were eagerly initialized. Converted that to lazily-initialized lists, so just NULL pointers until needed.
  • Tree walking was returning a list of matching nodes. Converted that to allocation-free walker. I used Roslyn code-generator to clean up the code and automatically generate switch statement and enumerator to return the next property to dive into.
  • Binder nodes had a ton of extraneous fields that seemed like a great idea 10 years ago. All eagerly allocated, most unused now as products I built them for are no longer here. Ruthlessly killed every single field, especially lists, made all the difference. Massive allocation reduction, massive speed increase.
  • In-memory representation of tokens consists of token ID and text range. I split that into two arrays as IDs are used all the time and ranges far less. Helps with cache locality.
  • Switched expression parser from recursing 10 levels until it gets to the base level into Pratt parser.
  • I had the bright idea to ignore setting up AST node parent as I didn't need it for parsing, then recursively setting it later just for binding. That recursive pass is expensive because the tree is sparse. Most properties are never set and it's faster to just set parent as property is assigned. Fixed that with the code generator to keep the codebase clean, got rid of recursive parent setting.
  • After I exhausted all ideas I could think of, I remembered that years ago I built a version of the parser for small scripts and it was much faster. Not all scripts are gigabytes in size, in fact almost none are. So parser now automatically uses compact representation for scripts under 64kB and switches to a wider one for larger ones.

I could speed this up further but the following approaches are not free:

  • Memory consumption could be fairly reduced via string interning but there is a performance penalty as now you're consulting a hash on every new identifier.
  • Memory consumption could be massively reduced by removing string property and there allocation of strings for each identifier. This would also significantly speed things up but would make the code uglier as we'd need to pass the original SQL string through all layers of the code. Don't need that at the moment.

If you made it this far in the super-niche topic of parsing, here are recommendations on how to use AI in coding:

  1. Sandbox it. That thing is unreliable.
  2. Give it a quick feedback loop. If it can change the code, re-run the tests, it will self-correct. I had it run on our suite of 27 thousand tests. All of that had to pass before I would commit.
  3. If you let it write the code, it will do a great job. Next code change will happily destroy an important part it built earlier. Have it commit on each round of changes.
  4. Don't let it have Github access. As I said, this thing is unreliable. Local commits are fine.
  5. I had it run dotnet-trace to find the hotspots after I exhausted my bucket list of optimizations. It turns out it can understand the output and use that as a feedback loop.
  6. Look at what's it doing. If your commits are so large you don't understand what and why is happening, you are up for some serious technical debt down the road.
  7. Let it generate the inline comments and keep them in code. Even if code is a source of truth, for AI comments will help in the future.
  8. AI will now, instead of messing up your code, write scripts to do search-replace. Or regex-replace. Or it will even write a Roslyn deep code rewriter just to change the deep pattern-matching code. Marvelous. It would take me forever to update all that code.

What has changed in the recent months? AI is still hallucinating (though less than before). It will always hallucinate, one has to be aware of that limitation. The harness around the LLM is better and now writes simple deterministic scripts when possible. 1M context window is a real game-changer for refactorings such as this one.

Doubling the performance of well-optimized code is rare. Not to mention that increasing the performance of non-optimized code hundredfold was done as a side-quest here. So yes, responsible AI use is highly recommended.

P.S. This same parser is what powers Safe Boundary, our new database security proxy. Early access is open.


If this was useful,
our newsletter will be too.

Get monthly insights on data engineering, AI, and building critical infrastructure - direct from the Spectral Core team and CEO Damir Bulic.

newsletter

Related posts

Spectral Core and Software Licensing Compliance Announce Partnership to Accelerate Oracle to PostgreSQL Migrations
Migration to Fabric

- 5 min read

Migration to Fabric

Introduction Microsoft introduced Microsoft Fabric, an all-in-one SaaS analytics solution for...

Emulating identity columns in Fabric