Use Nokogiri as the ActiveSupport XML backend
This significantly improves performance and reduces memory consumption when parsing XML files. On a test with 124 JUnit files from a CE build, there was about a 4x reduction in processing time. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54068
This commit is contained in:
parent
6494467a19
commit
198f2a0b61
4 changed files with 10 additions and 1 deletions
5
changelogs/unreleased/sh-use-nokogiri-xml-backend.yml
Normal file
5
changelogs/unreleased/sh-use-nokogiri-xml-backend.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Use Nokogiri as the ActiveSupport XML backend
|
||||
merge_request: 23136
|
||||
author:
|
||||
type: performance
|
|
@ -158,6 +158,9 @@ module Gitlab
|
|||
|
||||
config.action_view.sanitized_allowed_protocols = %w(smb)
|
||||
|
||||
# Nokogiri is significantly faster and uses less memory than REXML
|
||||
ActiveSupport::XmlMini.backend = 'Nokogiri'
|
||||
|
||||
# This middleware needs to precede ActiveRecord::QueryCache and other middlewares that
|
||||
# connect to the database.
|
||||
config.middleware.insert_after Rails::Rack::Logger, ::Gitlab::Middleware::BasicHealthCheck
|
||||
|
|
|
@ -14,7 +14,7 @@ module Gitlab
|
|||
test_case = create_test_case(test_case)
|
||||
test_suite.add_test_case(test_case)
|
||||
end
|
||||
rescue REXML::ParseException
|
||||
rescue Nokogiri::XML::SyntaxError
|
||||
raise JunitParserError, "XML parsing failed"
|
||||
rescue
|
||||
raise JunitParserError, "JUnit parsing failed"
|
||||
|
|
|
@ -9,3 +9,4 @@ require 'active_support/all'
|
|||
|
||||
ActiveSupport::Dependencies.autoload_paths << 'lib'
|
||||
ActiveSupport::Dependencies.autoload_paths << 'ee/lib'
|
||||
ActiveSupport::XmlMini.backend = 'Nokogiri'
|
||||
|
|
Loading…
Reference in a new issue