DRC Check gets very slow / stuck with creepage check enabled again with V9.0 release

Description

The issue that I reported during the development of V9.0 is again in the stable builds. See the old ticket (#19488 (closed)). I tested it with the V9.0.0 and V9.0.3. I couldn't test it with the nightly build that seemed to fix the issue back then (kicad-nightly-9.0.0.rc1.698.g41ef767676-x86_64.exe). If I remember correctly, the artificial board was checked very quickly, and the original board took around 30 seconds. Now the same original board runs again for 5-10 minutes before KiCad crashes.

The creepage check with the custom rules works as intended. However, the DRC checker gets very slow / stuck if the PCB contains many copper elements, >3000 pads, track segments, copper pores, etc. I would expect that the creepage check does not take longer when more elements are added that are not in the clearance range of the creepage distance, since these elements fulfill the creepage distance without any further detailed check.

Attached are two artificial projects that show the issue. The Issue_1 has 12 pads with a creepage constraint, and the Issue_2 has 24 pads with a creepage constraint. The additional vias in the table below denote the large via block on the left side of the board. "No" means they are deleted, "Yes" means they are present. These vias are not in the clearance range of the elements on the right that have a creepage constraint. So they should not be included in the creepage distance check. The performance of the check varies drastically depending on whether they are present or not. Also, the DRC time increases linearly with the number of pads that have a creepage constraint.

Project Additional Vias DRC Time
Issue_1 No 1s
Issue_1 Yes 35s
Issue_2 No 1s
Issue_2 Yes 71s

The fix that was introduced in the nightly build may have been lost in the stable release. The performance may also be further improved if a clearance check with the set creepage distance on the element is done first. If there is no violation, the creepage distance computation is not required.

Steps to reproduce

  1. Create a custom rule for checking creepage distance (rule BasicInsulationCreepage (constraint creepage (min 20mm)) (condition "A.hasNetclass('BI') && !B.hasNetclass('BI')") )
  2. Place a few tracks and via's in the creepage range of the components/pads with the 'BI' NetClass
  3. Increase the number of vias / track segments outside of the creepage range.

KiCad Version

Application: KiCad PCB Editor x64 on x64

Version: 9.0.3, release build

Libraries:
	wxWidgets 3.2.8
	FreeType 2.13.3
	HarfBuzz 10.2.0
	FontConfig 2.15.0
	libcurl/8.13.0-DEV Schannel zlib/1.3.1

Platform: Windows 11 (build 26100), 64-bit edition, 64 bit, Little endian, wxMSW
OpenGL: NVIDIA Corporation, NVIDIA GeForce RTX 3070/PCIe/SSE2, 4.6.0 NVIDIA 560.94

Build Info:
	Date: Jul  8 2025 05:19:33
	wxWidgets: 3.2.8 (wchar_t,wx containers)
	Boost: 1.88.0
	OCC: 7.9.1
	Curl: 8.13.0-DEV
	ngspice: 44
	Compiler: Visual C++ 1942 without C++ ABI
	KICAD_IPC_API=ON

Locale: 
	Lang: en_CH
	Enc: UTF-8
	Num: 1’234.5
	Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)

Issue_2_Project.zip

Issue_1_Project.zip

Application: KiCad x64 on x64

Version: 9.0.0, release build

Libraries:
	wxWidgets 3.2.6
	FreeType 2.13.3
	HarfBuzz 10.2.0
	FontConfig 2.15.0

Platform: Windows 11 (build 26100), 64-bit edition, 64 bit, Little endian, wxMSW

	wxWidgets: 3.2.6 (wchar_t,wx containers)
	Boost: 1.86.0
	OCC: 7.8.1
	Curl: 8.11.1-DEV
	ngspice: 44
	Compiler: Visual C++ 1942 without C++ ABI
	KICAD_IPC_API=ON

Locale: 
	Lang: en_CH
	Enc: UTF-8
	Num: 1’234.5
	Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)
Edited by dsa-t