Hello everyone,
I've developed a JavaScript script for HTML/XML validation, and while the core logic is fast, I'm facing a significant performance bottleneck when reading large files or processing files in batch. I'm hoping to get some advice on a more efficient approach.
My Current (Slow) Method
Currently, I read file content by loading the file into the active document and using `selectAll()`:
This method works, but it struggles under these conditions:
- Processing larger files
- Running batch validation on many files (like 100+ files)
- The script takes minutes instead of seconds
Script Overview
To provide context, my script performs the following tasks:
- Validates HTML/XML files for errors
- Checks table structures, links, and references
- Generates detailed error reports
- Can process single files or entire folders
What I Need Help With:
1. Is there a faster way to read file content? The `selectAll()` method seems to be the bottleneck.
2. Can I read files without opening them in the editor? When processing 100 files, opening and closing each one takes a lot of time.
3. Any tips for handling large files better? Some files I work with are 5MB+.
Important Note: UEStudio vs. UltraEdit Behavior
I've discovered a critical difference in behavior between UEStudio and UltraEdit:
Works: The script runs correctly in UEStudio v12.20.0.1004.
Fails: The script is either non-functional in UltraEdit v27.00.0.22.
This suggests there might be a difference in the scripting engines or available objects between the two applications that could be related to my issue.
The validation logic itself runs fast - it's just the file reading that's slow. I'm looking for any method or trick to read files faster in UltraEdit's JavaScript.
My validation logic itself is not the problem—the bottleneck is purely in how I'm getting the data into the script. I have attached my script for your review.
Any advice on alternative functions or a better overall strategy for this task would be greatly appreciated.
Thank you
I've developed a JavaScript script for HTML/XML validation, and while the core logic is fast, I'm facing a significant performance bottleneck when reading large files or processing files in batch. I'm hoping to get some advice on a more efficient approach.
My Current (Slow) Method
Currently, I read file content by loading the file into the active document and using `selectAll()`:
Code: Select all
// This is the part of the script that is slow
UltraEdit.activeDocument.selectAll();
var fileContent = UltraEdit.activeDocument.selection;
// ... validation logic using fileContent runs here ...- Processing larger files
- Running batch validation on many files (like 100+ files)
- The script takes minutes instead of seconds
Script Overview
To provide context, my script performs the following tasks:
- Validates HTML/XML files for errors
- Checks table structures, links, and references
- Generates detailed error reports
- Can process single files or entire folders
What I Need Help With:
1. Is there a faster way to read file content? The `selectAll()` method seems to be the bottleneck.
2. Can I read files without opening them in the editor? When processing 100 files, opening and closing each one takes a lot of time.
3. Any tips for handling large files better? Some files I work with are 5MB+.
Important Note: UEStudio vs. UltraEdit Behavior
I've discovered a critical difference in behavior between UEStudio and UltraEdit:
Works: The script runs correctly in UEStudio v12.20.0.1004.
Fails: The script is either non-functional in UltraEdit v27.00.0.22.
This suggests there might be a difference in the scripting engines or available objects between the two applications that could be related to my issue.
The validation logic itself runs fast - it's just the file reading that's slow. I'm looking for any method or trick to read files faster in UltraEdit's JavaScript.
My validation logic itself is not the problem—the bottleneck is purely in how I'm getting the data into the script. I have attached my script for your review.
Any advice on alternative functions or a better overall strategy for this task would be greatly appreciated.
Thank you
- Validator_HTML_XML.zip (32.22 KiB) 0


