Systems and methods for rendering data based on fixed-length templating

Systems, methods, and non-transitory computer-readable media can receive a plurality of web templates associated with a web page. A buffer having a fixed, pre-determined length is allocated. A first set of data associated with a first web template of the plurality of web templates is copied to the buffer. A second set of data associated with a second web template of the plurality of web templates is copied to the buffer.

FIELD OF THE INVENTION

The present technology relates to the field of page rendering. More particularly, the present technology relates to systems and methods for page rendering using fixed-length templating.

BACKGROUND

Today, people often utilize computing devices (or systems) for a wide variety of purposes. Users can use their computing devices, for example, to interact with one another, create content, share content, and view content. In some cases, a user can utilize his or her computing device to access a social networking system (or service). The user can provide, post, share, and access various content items, such as status updates, images, videos, articles, and links, via the social networking system.

SUMMARY

Various embodiments of the present disclosure can include systems, methods, and non-transitory computer readable media configured to receive a plurality of web templates associated with a web page. A buffer having a fixed, pre-determined length is allocated. A first set of data associated with a first web template of the plurality of web templates is copied to the buffer. A second set of data associated with a second web template of the plurality of web templates is copied to the buffer.

In an embodiment, each web template of the plurality of web templates comprises template data associated with a set of render instructions and dynamic render data defining a web page element to be rendered.

In an embodiment, the buffer comprises a template data portion having a first fixed length, and a render data portion having a second fixed length.

In an embodiment, copying the first set of data associated with the first web template of the plurality of web templates to the buffer comprises: copying a first set of template data associated with the first web template to the template data portion; and copying a first set of dynamic render data associated with the first web template to the render data portion.

In an embodiment, the copying the second set of data associated with the second web template of the plurality of web templates to the buffer comprises: copying a second set of dynamic render data associated with the second web template to the render data portion without modifying the template data portion.

In an embodiment, the copying the second set of data associated with the second web template of the plurality of web templates to the buffer is performed based on a determination that template data associated with the second web template is substantially identical to template data stored within the buffer.

In an embodiment, the allocating the buffer is performed based on a determination that template data associated with the first web template is not substantially identical to template data stored within any existing buffer.

In an embodiment, a first web page element is rendered based on the first set of data.

In an embodiment, a second web page element is rendered based on the second set of data.

In an embodiment, the first and second web page elements are provided to a user computing device for presentation to a user.

DETAILED DESCRIPTION

Rendering Data Based on Fixed-Length Templating

Today, people often utilize computing devices (or systems) for a wide variety of purposes. Users can use their computing devices, for example, to interact with one another, create content, share content, and view content. In some cases, a user can utilize his or her computing device to access a social networking system (or service). The user can provide, post, share, and access various content items, such as status updates, images, videos, articles, and links, via the social networking system.

When users attempt to access a web page, such as a web page on a social networking system, web templates may be used to render the web page. For example, a web server that receives a request for a particular web page can retrieve one or more web templates associated with the web page. The web server can process the one or more web templates to render the web page. The rendered web page can then be provided to a user computing device to display the web page (e.g., within a web browser presented on a display of the user computing device).

However, rendering web pages based on web templating can be very CPU-intensive. This is particularly true for web pages containing a large number of dynamic elements that are constantly changing and being updated, as may be the case on a social networking system. For example, consider a simple example scenario in which a web page has two web templates to be rendered, and each of the two web templates is configured to render a username. For example, the two web templates may have the following form: <html> <body> <% username %> </body> </html>. The first web template can be configured to render a first username, “Doug,” and the second web template can be configured to render a second username, “Zachariah.” In rendering the web page, a web server will generally allocate a buffer based on a size associated with the first web template. The web server can then copy initial template data for the first web template into the buffer (e.g., “<html> <body>”), copy dynamic render data for the first web template to the buffer (e.g., “Doug”), and copy final template data for the first web template into the buffer (e.g., “</body> </html>”). This essentially translates to four steps that are performed by a web server CPU: (1) allocate a buffer; (2) copy initial template data to the buffer; (3) copy and render dynamic render data to the buffer; and (4) copy final template data to the buffer.

Once the first web template has been processed and rendered, the web server can process the second web template. It can be seen in the above example that the dynamic render data in the second web template (i.e., “Zachariah”) has a different size than the dynamic render data in the first web template (i.e., “Doug”). As such, more buffer space must be allocated for the second web template than was allocated for the first web template. Under conventional systems, in order to render the second web template, the web server CPU will typically repeat all four steps described above, i.e., allocate a new buffer based on a size associated with the second web template, copy initial template data for the second web template into the new buffer, copy dynamic render data for the second web template into the new buffer, and copy final template data for the second web template into the new buffer. If there are additional web templates, the four steps are repeated for each additional web template. Conventional approaches fail to take advantage of significant similarities between web templates, resulting in inefficiencies and unnecessary repetition of steps. Repetition of CPU-intensive rendering tasks may slow down web render speeds, and may be detrimental to user experience. Accordingly, conventional approaches may not be effective in addressing these and other problems arising in computer technology.

An improved approach rooted in computer technology overcomes the foregoing and other disadvantages associated with conventional approaches specifically arising in the realm of computer technology. In general, a plurality of web templates associated with a web page can be processed using a single buffer that is allocated one time for a first web template, and then re-used and updated for any remaining web templates. Only dynamic portions within the buffer are re-written and updated, while unchanged portions of the buffer are not re-written. In accordance with the present technology, systems and methods can maintain a buffer of a fixed length while processing web templates having different sizes by using padding to account for differences in size. The present technology can achieve improvements in CPU performance for processing and/or rending a plurality of web templates by allocating a single, fixed-length buffer, re-using the allocated buffer, re-using unchanged portions of the buffer, and re-writing only changed portions of the buffer. This is in contrast to conventional approaches that re-allocate a buffer and re-write the entire buffer for every web template. Additional details about the disclosed technologies will be provided herein.

FIG. 1illustrates an example system100including a fixed-length templating module102, according to an embodiment of the present disclosure. The fixed-length templating module102can be configured to render a plurality of web templates associated with a web page. In various embodiments, the fixed-length templating module102can be configured to identify a plurality of web templates associated with a web page. Each web template of the plurality of web templates can comprise template data associated with a set of render instructions, and dynamic render data defining an element to be rendered. In various embodiments, each web template of the plurality of web templates can comprise substantially identical template data. The fixed-length templating module102can process a first web template of the plurality of web templates. The first web template can comprise a first set of template data and a first set of dynamic render data. Processing the first web template can comprise allocating a buffer. In various embodiments, the buffer can have a pre-determined, fixed length or size. The fixed-length templating module102can copy the first set of template data to a template data portion of the buffer, and can copy the first set of dynamic render data to a render data portion of the buffer. The template data portion and the render data portion of the buffer can have fixed lengths. The render data portion, despite having a fixed length, can accommodate dynamic render data of different sizes by using padding to fill in any unused portion of the render data portion. A first web page element can be rendered based on the first set of dynamic render data.

The fixed-length templating module102can process a second web template of the plurality of web templates. The second web template can comprise a second set of template data and a second set of dynamic render data. In various embodiments, processing the second web template can comprise a determination that the second set of template data is substantially identical to template data currently stored in an existing buffer. Based on that determination, the existing buffer is not re-allocated, the template data portion of the existing buffer is not changed, and the second set of dynamic render data is copied to the render data portion of the existing buffer. The fixed-length templating module102can render a second element based on the second set of dynamic render data. The fixed-length templating module102can provide a rendered web page comprising the first and second elements to a user computing device for presentation to a user.

As shown in the example ofFIG. 1, the fixed-length templating module102can include a template processing module104and a rendering module106. In some instances, the example system100can include at least one data store110. The components (e.g., modules, elements, etc.) shown in this figure and all figures herein are exemplary only, and other implementations may include additional, fewer, integrated, or different components. Some components may not be shown so as not to obscure relevant details. In various embodiments, one or more of the functionalities described in connection with the fixed-length templating module102can be implemented in any suitable combinations.

In some embodiments, the fixed-length templating module102can be implemented, in part or in whole, as software, hardware, or any combination thereof. In general, a module, as discussed herein, can be associated with software, hardware, or any combination thereof. In some implementations, one or more functions, tasks, and/or operations of modules can be carried out or performed by software routines, software processes, hardware, and/or any combination thereof. In some cases, the fixed-length templating module102can be implemented, in part or in whole, as software running on one or more computing devices or systems, such as on a user or client computing device. For example, the fixed-length templating module102, or at least a portion thereof, can be implemented as or within an application (e.g., app), a program, or an applet, etc., running on a user computing device or a client computing system, such as the user device610ofFIG. 6. In another example, the fixed-length templating module102, or at least a portion thereof, can be implemented using one or more computing devices or systems that include one or more servers, such as network servers or cloud servers. In some instances, the fixed-length templating module102can, in part or in whole, be implemented within or configured to operate in conjunction with a social networking system (or service), such as the social networking system630ofFIG. 6. It should be understood that there can be many variations or other possibilities.

The fixed-length templating module102can be configured to communicate and/or operate with the at least one data store110, as shown in the example system100. The data store110can be configured to store and maintain various types of data. In some implementations, the data store110can store information associated with the social networking system (e.g., the social networking system630ofFIG. 6). The information associated with the social networking system can include data about users, user identifiers, social connections, social interactions, profile information, demographic information, locations, geo-fenced areas, maps, places, events, pages, groups, posts, communications, content, feeds, account settings, privacy settings, a social graph, and various other types of data. In some embodiments, the data store110can store information that is utilized by the fixed-length templating module102. For example, the data store110can store one or more web pages, web templates, rendering instructions, rendered elements, rendered web pages, buffers, and the like. It is contemplated that there can be many variations or other possibilities.

The template processing module104can be configured to process one or more web templates associated with a web page. Each web template of the one or more web templates can comprise template data associated with a set of render instructions, and dynamic render data defining an element to be rendered. The template processing module104can process a first web template of the one or more web templates. The first web template can comprise a first set of template data and a first set of dynamic render data. Processing the first web template can comprise allocating a buffer. In various embodiments, the buffer can have a pre-determined, fixed size. The template processing module104can copy the first set of template data to a template data portion of the buffer, and can copy the first set of dynamic render data to a render data portion of the buffer. The template data portion and the render data portion of the buffer can have fixed lengths. The template processing module104can fill with padding any portion of the render data portion that is unused after copying the first set of dynamic render data. As discussed above, fill-padding allows for the fixed-length render data portion to accommodate render data having different sizes.

The template processing module104can be configured to identify one or more additional web templates of the one or more web templates that have template data substantially identical to the first set of template data. The template processing module104can process each of the one or more additional web templates by re-using the template data portion of the buffer, and updating the render data portion of the buffer with dynamic render data associated with the additional web template. By updating only the render data portion of the buffer and re-using the template data portion of the buffer, the buffer is re-used (i.e., is not re-allocated) for each of the one or more additional web templates. The template processing module104is described in greater detail herein with reference toFIG. 2.

The rendering module106can be configured to render one or more web page elements associated with a web page. In some embodiments, each web page element can be associated with a web template associated with the web page. As described herein, when a web template is processed, template data and dynamic render data associated with the web template are copied to a buffer. The rendering module106can render a web page element based on template data and dynamic render data copied to a buffer. As each web template in a plurality of web templates is processed, dynamic rendering data in the buffer is updated, and the rendering module106can render a web page element each time dynamic rendering data is updated in the buffer. The rendering module106can also be configured to transmit and/or provide one or more rendered web page elements to a user computing device for presentation to a user. For example, once a plurality of web templates associated with a web page have been processed, resulting in a plurality of rendered web page elements, the plurality of web page elements can be provided to a user computing device so that the web page can be presented to a user.

FIG. 2illustrates an example template processing module202configured to process one or more web templates associated with a web page, according to an embodiment of the present disclosure. In some embodiments, the template processing module104ofFIG. 1can be implemented as the template processing module202. As shown in the example ofFIG. 2, the template processing module202can include a data parsing module204, a buffer management module206, a data writing module208.

The data parsing module204can be configured to receive a web template associated with a web page, and to parse the web template into a plurality of components. In certain embodiments, a web template can comprise template data associated with a set of instructions for rendering web page elements, and dynamic render data defining a web page element to be rendered. The data parsing module204can be configured to parse a web template into template data and dynamic render data. In certain embodiments, template data can comprise HTML start and end tag information. In certain embodiments, dynamic render data can comprise HTML code content positioned between HTML start and end tags.

The buffer management module206can be configured to determine whether to allocate a new buffer or re-use an existing buffer for processing a web template. As discussed above, the web template can include template data and dynamic render data. The buffer management module206can be configured to determine whether to allocate a new buffer or to re-use an existing buffer based on the template data associated with the web template being processed. If the template data is substantially identical to template data stored in an existing buffer, the buffer management module206can determine that the existing buffer can be re-used for processing the web template. In certain embodiments, an existing buffer is re-used if the template data is identical to template data stored in the existing buffer. In certain embodiments, an existing buffer is re-used if the template data in the web template comprises the same type and number of tags as template data stored in the existing buffer. Conversely, if the template data is not substantially identical to template data stored in an existing buffer, the buffer management module206can determine that a new buffer should be allocated. In such a case, the buffer management module206can allocate a new buffer to process the web template.

The data writing module208can be configured to write (i.e., copy) data to a buffer. If it has been determined that a new buffer should be allocated to process a web template, the data writing module208can copy template data associated with the web template to a template data portion of the new buffer, and dynamic render data associated with the web template to a render data portion of the new buffer. However, if it has been determined that an existing buffer can be re-used to process a web template, the data writing module208can leave a template data portion of the existing buffer unchanged, and can copy dynamic render data associated with the web template to a render data portion of the existing buffer. In other words, the data writing module208can update the render data portion of the existing buffer without modifying the template data portion of the buffer. The data writing module208can also be configured to fill any unused portion of the dynamic render portion with padding after dynamic render data has been copied to the dynamic render portion. In certain embodiments, the template data portion and/or the render data portion may be divided into multiple, non-contiguous portions. For example, the template data portion can include a first (e.g., an initial) template data portion and a second (e.g., final) template data portion. The first template data portion and the second template data portion can be written separately within a buffer. For example, the first template data portion can precede a render data portion within the buffer, and the second template data portion can follow the render data portion within the buffer. Many variations are possible.

Various features and benefits of the present disclosure will now be discussed with reference to three example scenarios depicted inFIGS. 3, 4A, and 4B, which are simplified for purposes of illustration. Each example scenario is associated with rendering of a web page comprising two web templates. The two web templates are configured to render usernames. A first web template is configured to render the username “Doug” and a second web template is configured to render the username “Zachariah.”FIG. 3illustrates processing of the two web templates using some conventional techniques, whileFIGS. 4A-Billustrate processing of the two web templates based on fixed length templating, according to various embodiments of the present disclosure.

FIG. 3illustrates an example scenario300associated with conventional processing of web templates. The example scenario300includes a first web template302for rendering a username “Doug” and a second web template320for rendering a username “Zachariah.” The first web template302comprises initial template data308(“<html> <body>”), dynamic render data310(“Doug”), and final template data312(“</html> </body>”). In the example scenario300, the initial template data308is 16 bytes, the dynamic render data310is 4 bytes, and the final template data312is 16 bytes. The sizes of the template data and the dynamic render data inFIGS. 3 and 4can be other values in other examples. Under some conventional approaches, processing the first web template302can comprise allocating a buffer304within a memory306, and copying the initial template data308, the dynamic render data310, and the final template data312to the buffer304. The buffer304is allocated based on size requirements associated with the web template302.

The second web template320comprises initial template data324(“<html> <body>”), dynamic render data326(“Zachariah”), and final template data328(“</html> </body>”). In the example scenario300, the initial template data324is identical to the initial template data308, and the final template data328is identical to the final template data312. As such, the initial template data324is 16 bytes and the final template data328is 16 bytes. However, the dynamic render data326is different from the dynamic render data310. The dynamic render data326is 10 bytes, which is 6 bytes longer than the dynamic render data310. Under some conventional approaches, processing the second web template320can comprise allocating a buffer322within the memory306, and copying the initial template data324, the dynamic render data326, and the final template data328to the buffer322. The buffer322that is allocated for the second web template320must be larger than the buffer304allocated for the first web template302to accommodate the larger dynamic render data326. Although the first web template302and the second web template320have identical template data, the initial template data324and the final template data328must be re-written in the new buffer322.

In total, the example scenario300includes eight CPU tasks that are undertaken to process the first web template302and the second web template320: (1) allocate a first buffer304; (2) copy initial template data308to the first buffer304; (3) copy dynamic render data310to the first buffer304; (4) copy final template data312to the first buffer304; (5) re-allocate a new buffer322; (6) copy initial template data324to the new buffer322; (7) copy dynamic render data326to the new buffer322; and (8) copy final template data328to the new buffer322.

FIG. 4Aillustrates an example scenario400associated with processing a plurality of web templates based on fixed-length templating, according to an embodiment of the present disclosure. Similar to the example scenario300, the example scenario400includes a first web template402configured to render a username “Doug” and a second web template430configured to render a username “Zachariah.”

The second web template430has the initial template data412and the final template data416that is identical to the first web template402. As such, in the example scenario400, it has been determined that the buffer404can be re-used for processing the second web template430based on the fact that the second web template430has template data that is substantially identical to template data stored in the buffer404. Since the buffer404already stores the initial template data412and the final template data416, the template data portion413,415of the buffer404does not need to be changed when processing the second web template430. As such, in accordance with the present disclosure, the render data portion414is updated with the dynamic render data436. Again, any unused portion of the render data portion414can be filled in with padding438.

As discussed above, the example scenario300shown inFIG. 3included eight CPU tasks for processing two web templates. However, in the example scenario400, savings are earned by allocating the buffer and copying template data only one time. As such, processing the two web templates402,430requires only six CPU tasks: (1) allocate a buffer404; (2) copy initial template data412to the buffer404; (3) copy dynamic render data420to the buffer404; (4) copy final template data416to the buffer404; (5) determine that the buffer404can be re-used; and (6) copy dynamic render data436to the buffer404. As such, in this simplified example, a savings of two CPU tasks is already realized. In web pages with additional web templates to be analyzed, and more complex web templates to be analyzed, even greater efficiencies can be achieved. The foregoing examples are for illustration purposes only, and many variations are possible.

FIG. 4Billustrates another example scenario450associated with processing a plurality of web templates based on fixed-length templating, according to an embodiment of the present disclosure. The example scenario450is very similar to the example scenario400ofFIG. 4A. Like the example scenario400, the example scenario450includes a first web template402configured to render a username “Doug” and a second web template430configured to render a username “Zachariah.” The first web template402has the same template data and dynamic render data420as those discussed inFIG. 4A. However, rather than keeping separate the initial template data412and the final template data416, they have been combined into a single template data452having a size of 32 bytes. As it will be seen, this small change further decreases the number of computing tasks performed by a CPU.

Similar to example scenario400, in processing the first web template402, a buffer404is allocated in a memory406. Again, the buffer404, in this example, has a fixed size of 48 bytes. In the example scenario450, the template data452is written to a template data portion454of the buffer404. The template data portion454has a fixed length, which, in this example, is 32 bytes. The remaining 16 bytes of the buffer404define a render data portion456having a fixed length of 16 bytes. Dynamic render data420is copied to the render data portion454. Similar to example scenario400, the dynamic render data420is only 4 bytes in size, and the remaining 12 bytes of the render data portion456is filled with padding422.

The second web template430has template data452that is identical to the first web template402. As such, in the example scenario450, it has been determined that the buffer404can be re-used for processing the second web template430based on the fact that the second web template430has template data that is substantially identical to template data452stored in the buffer404. Since the buffer404already stores the template data452, the template data portion454does not need to be changed when processing the second web template430. As such, in accordance with the present disclosure, the render data portion456is updated with dynamic render data436. Again, any unused portion of the render data portion456can be filled in with padding438.

As discussed above, the example scenario300shown inFIG. 3included eight CPU tasks for processing two web templates, and the example scenario400shown inFIG. 4Aincluded six CPU tasks. However, in the example scenario450, further savings are earned by combining all template data and writing the template data into the buffer in a single step. As such, processing the two web templates402,430requires only five CPU tasks: (1) allocate a buffer404; (2) copy template data452to the buffer404; (3) copy dynamic render data420to the buffer404; (4) determine that the buffer404can be re-used; and (5) copy dynamic render data436to the buffer404. As such, in this simplified example, a savings of three CPU tasks is realized over the example scenario300. Once again, in web pages with additional web templates to be analyzed, and more complex web templates to be analyzed, even greater efficiencies can be achieved. The foregoing examples are for illustration purposes only, and many variations are possible.

FIG. 5illustrates an example method500associated with rendering data using fixed-length templating, according to an embodiment of the present disclosure. It should be appreciated that there can be additional, fewer, or alternative steps performed in similar or alternative orders, or in parallel, within the scope of the various embodiments discussed herein unless otherwise stated.

At block502, the example method500can receive a plurality of web templates associated with a web page. At block504, the example method500can allocate a buffer having a fixed, pre-determined length. At block506, the example method500can copy a first set of data associated with a first web template of the plurality of web templates to the buffer. At block508, the example method500can copy a second set of data associated with a second web template of the plurality of web templates to the buffer.

It is contemplated that there can be many other uses, applications, and/or variations associated with the various embodiments of the present disclosure. For example, in some cases, user can choose whether or not to opt-in to utilize the disclosed technology. The disclosed technology can also ensure that various privacy settings and preferences are maintained and can prevent private information from being divulged. In another example, various embodiments of the present disclosure can learn, improve, and/or be refined over time.

Social Networking System—Example Implementation

The user device610comprises one or more computing devices that can receive input from a user and transmit and receive data via the network650. In one embodiment, the user device610is a conventional computer system executing, for example, a Microsoft Windows compatible operating system (OS), Apple OS X, and/or a Linux distribution. In another embodiment, the user device610can be a device having computer functionality, such as a smart-phone, a tablet, a personal digital assistant (PDA), a mobile telephone, etc. The user device610is configured to communicate via the network650. The user device610can execute an application, for example, a browser application that allows a user of the user device610to interact with the social networking system630. In another embodiment, the user device610interacts with the social networking system630through an application programming interface (API) provided by the native operating system of the user device610, such as iOS and ANDROID. The user device610is configured to communicate with the external system620and the social networking system630via the network650, which may comprise any combination of local area and/or wide area networks, using wired and/or wireless communication systems.

The external system620includes one or more web servers that include one or more web pages622a,622b, which are communicated to the user device610using the network650. The external system620is separate from the social networking system630. For example, the external system620is associated with a first domain, while the social networking system630is associated with a separate social networking domain. Web pages622a,622b, included in the external system620, comprise markup language documents614identifying content and including instructions specifying formatting or presentation of the identified content.

In some embodiments, the social networking system630can include a fixed-length templating module646. The fixed-length templating module646can, for example, be implemented as the fixed-length templating module102, as discussed in more detail herein. As discussed previously, it should be appreciated that there can be many variations or other possibilities. For example, in some embodiments, one or more functionalities of the fixed-length templating module646can be implemented in the user device610.

Hardware Implementation