Remove c
article thumbnail

Faster remainders when the divisor is a constant: beating compilers and libdivide

Daniel Lemire

I believe that all optimizing C/C++ compilers know how to pull this trick and it is generally beneficial irrespective of the processor’s architecture. In concrete terms, here is the C code to compute the remainder of the division by some fixed divisor d : uint32_t d =. ; // your divisor > 0. Can we do better?

C++ 279
article thumbnail

Fundamentals of table expressions, Part 5 – CTEs, logical considerations

SQL Performance

T-SQL supports it starting with SQL Server 2005. What’s different about the design of CTEs compared to derived tables is where in the code these three elements are located. However, there are very few cases in T-SQL where without a terminator the code is ambiguous. The elements are sort of intertwined.

C++ 140
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

Deprecated features to take out of your toolbox – Part 3

SQL Performance

These types are on the deprecated list for many reasons, and have held a permanent spot on that list since being replaced by the max types way back in SQL Server 2005. name , [ Column ] = c. name , [ Data Type ] = TYPE_NAME ( c. system_type_id <> c. THEN N' (' + TYPE_NAME ( c.

C++ 58
article thumbnail

Additional T-SQL Improvements in SQL Server 2022

SQL Performance

If you’ve been writing and optimizing T-SQL code for a while, you’re probably well aware of the many complexities involved with NULL handling. 75 Test XYZ Student C 55 Test XYZ 77.5 75 Test XYZ Student C 55 Test XYZ 77.5 75 Test XYZ Student C 55 Test XYZ 77.5 You can download this sample database here.

Servers 142
article thumbnail

Overlooked T-SQL Gems

SQL Performance

Consequently, handling our task becomes a no-brainer: DECLARE @s AS VARCHAR ( 20 ) = '123.456.789,00' ; SELECT TRANSLATE ( @s , '.,' , ',' ) ; This code generates the desired output: 123,456,789.00. databases ; OPEN C ; FETCH NEXT FROM C INTO @dbname ; WHILE @@FETCH_STATUS = 0. That's pretty neat!

C++ 111
article thumbnail

Advent Calendars For Web Designers And Developers (December 2021 Edition)

Smashing Magazine

Advent of Code. If you prefer a puzzle over an article, take a look at Advent of Code. C# Advent Calendar. It’s time for the fifth annual C# advent calendar that will feature two pieces of content every day. Code Security Advent Calendar. It launched in 2005 and still has all of the calendars available online.

Design 107
article thumbnail

Web Performance Bookshelf

Rigor

Steve Souders, plus Dion Almaer, Doug Crockford, Ben Galbraith, Tony Gentilcore, Dylan Schiemann, Stoyan Stefanov, Nicole Sullivan, Nicholas C. The in-depth explorations are meticulously illustrated and code examples culminate as bulletproof code snippets, applicable to your work right away. ” – Andy King, 2003.