VOOZH about

URL: https://thenewstack.io/4-anti-patterns-that-microsoft-recommends-web-devs-avoid/

⇱ 4 Anti-Patterns That Microsoft Recommends Web Devs Avoid - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-05-26 06:56:51
4 Anti-Patterns That Microsoft Recommends Web Devs Avoid
Frontend Development / Software Development

4 Anti-Patterns That Microsoft Recommends Web Devs Avoid

Microsoft spent the past year researching what causes poor web performance. Here are four commonly used anti-patterns to avoid.
May 26th, 2023 6:56am by Loraine Lawson
👁 Featued image for: 4 Anti-Patterns That Microsoft Recommends Web Devs Avoid

Microsoft has spent the past year “diving deep into web performance,” Rob Paveza, a principal software engineering manager, said during Microsoft’s conference, Build, a live and in-person event held this week.

Paveza and Zohar Ghadyali, program manager on the Microsoft Edge Dev Tools team, introduced a slew of new and experimental features available in Edge 114, which is in beta but scheduled for stable release June 2. The features are designed to improve performance as well as developer experience and include debugging assistance, a new JSON viewer, new dev tools, and Focus Mode.

But the team didn’t just examine what it could do differently to address web performance. Paveza also identified four common anti-patterns that developers can avoid to improve the speed of their web applications.

Anti-Pattern One: Using SVG Animations

SVG animations can be used to apply transformations, but they cause abnormally high CPU usage and “unexpected outcomes that we were surprised to see,” Paveza said, adding that it “caused a bit of work for the web platform team to go investigate and track down.”

What the team learned is that CSS animations have better performance. The animation tool and Dev Tools has much better support for CSS animations, he added.

Anti-Pattern Two: CSS Properties That Trigger Reflow

“Another issue that the browser runs into is reflow,” Paveza said. “This is when the browser recalculates the positions and geometries of the elements on the page with the goal of re-rendering part or all of the page. This is a costly operation and can block user input.”

Developers should minimize using CSS properties that trigger reflow or changing them, he said.

“Some CSS properties can actually be handled by the compositor thread instead of the main thread,” he added. “When you do have to change these properties at runtime, the ones that are better to use are those like transform and opacity. So we strongly encourage you to do that.”

Anti-Pattern Three: The Large DOM

It makes sense intuitively that the browser will take longer to handle DOM mutations, or recalculate cells, or compute layout when there’s a large DOM, simply because there are more elements on the page, Paveza said.

“When you’re using libraries like React that render components for you, we found some techniques like using React fragments, or just plain open bracket close bracket, instead of actual elements, can improve performance,” he suggested.

Another important technique to know about is the Shadow DOM.

“This is another major functionality of the web platform that we want to call out, because it provides containment, meaning that subsets of your DOM can mutate or need to be restyled without affecting all of the other elements outside of that shadow,” he said.

Anti-Pattern Four: CSS in JavaScript

Keep your CSS out of your JavaScript for faster performance, advised Pavez.

“CSS in JS absolutely has some benefits from a developer ergonomics perspective — you can write styles for specific components, you can specify dynamic styles, and it simplifies the amount of things that you have to juggle as a web developer between JavaScript, HTML and CSS,” Paveza explained. “However, we absolutely have observed poor performance.”

Injecting these styles into JavaScript takes longer to handle than vanilla CSS, he added.

“We strongly recommend extracting your CSS in JS to a stylesheet, and then serving that alongside your JavaScript for better performance,” he added.

TRENDING STORIES
Loraine Lawson is a veteran technology reporter who has covered technology issues from data integration to security for 25 years. Before joining The New Stack, she served as the editor of the banking technology site Bank Automation News. She has...
Read more from Loraine Lawson
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.