Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4127082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:07:03+00:00 2026-05-21T00:07:03+00:00

I have a list of about 1,000,000 ActiveRecord objects that I am using Nokogiri

  • 0

I have a list of about 1,000,000 ActiveRecord objects that I am using Nokogiri to build. Right now I am calling a method on each object to create a builder and return it. THen I write that builder to an already open file with:

builder.to_xml

It works fine, but I was wondering if somehow I could create an empty builder element and clone it (or something, that might be just as expensive of an operation) and send it to the AR instance method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T00:07:04+00:00Added an answer on May 21, 2026 at 12:07 am

    For 1,000,000 objects I’d look into using ERB or Erubis to generate the XML using a hand-coded template.

    Nokogiri is dynamically creating each element, which is costly in comparison to the speed of a process that already knows what to do for each object.

    Erubis is faster than ERB, but ERB is the standard for Rails. The templates are interchangeable.

    Another alternate is to see if you can get your database to output the selected records as XML based on a query. It’s going to be the fastest way to generate the data file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of about 10,000 phrases (1-5 words each). When the user
I need to compare two lists where each list contains about 60,000 objects. what
I have a service that runs that takes a list of about 1,000,000 dictionaries
I have a list of about 600 jobs that I can't delete from the
I have about 10 drop down list controls that get populated. Instead of copying/pasting
I have a list of upwards 3,000 decimal values and for each one I
I have a CSV file with a list of banned usernames --it's about 10,000
Basically I have about 1,000,000 strings, for each request I have to check if
I have 50,000 user records that contain a field booklist with a list of
We have a list of about 150,000 words, and when the user enters a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.